Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 05:13:46 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Using conditional CSS stylesheets for Internet Explorer  (Read 920 times)
sam

Offline Offline

Posts: 8


« on: December 05, 2007, 09:59:36 PM »

I want to use a conditional stylesheet so that my CSS displays properly in internet explorer. I have searched the forums here, but can't find how to make this work properly.

I have put the following in the header of my index.php file:


<head>
<title><?php page_title('', '[WEBSITE_TITLE]'); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else { echo 'utf-8'; }?>" />
<meta name="description" content="<?php page_description(); ?>" />
<meta name="keywords" content="<?php page_keywords(); ?>" />

<!-- style sheet links -->
<link href="<?php echo TEMPLATE_DIR; ?>/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?php echo TEMPLATE_DIR; ?>/menu.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?php echo TEMPLATE_DIR; ?>/menu2.css" rel="stylesheet" type="text/css" media="screen" />
<!-- if [IE 6]><link href="<?php echo TEMPLATE_DIR; ?>/ie56.css" rel="stylesheet" type="text/css" media="screen" />
<![endif]-->

</head>

<body>

This is not working; internet explorer is still displaying the same style.css stylesheet, not the ie56.css one.

How do I make this work correctly?

Thanks!
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #1 on: December 06, 2007, 04:48:20 AM »

Hello,

you are here in the WB forum. This is no WB question it is more a css or browser related question. So have a look on the bookmarks list on our help page or simply try googling.

Thanks

Matthias
Logged
sam

Offline Offline

Posts: 8


« Reply #2 on: December 06, 2007, 01:05:24 PM »

Hi Matthias -

Thanks for your response. I know that this is more a CSS related question than WebsiteBaker directly, but I've googled, and looked in reference books about CSS; as far as I can see, this should work. I posted it here to see if there was some glitch I need to be aware of with website baker that stops this from working, or some other way I need to present the code.

I'm still at a loss as to why it's not working! Everything I can see says it should...

Thanks

Sam
Logged
sam

Offline Offline

Posts: 8


« Reply #3 on: December 06, 2007, 02:45:08 PM »

I have now fixed this; the correct code is as follows:

<head>
<title><?php page_title('', '[WEBSITE_TITLE]'); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else { echo 'utf-8'; }?>" />
<meta name="description" content="<?php page_description(); ?>" />
<meta name="keywords" content="<?php page_keywords(); ?>" />

<!-- style sheet links -->
<link href="<?php echo TEMPLATE_DIR; ?>/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?php echo TEMPLATE_DIR; ?>/menu.css" rel="stylesheet" type="text/css" media="screen" />
<link href="<?php echo TEMPLATE_DIR; ?>/menu2.css" rel="stylesheet" type="text/css" media="screen" />

<!--[if IE]><link href="<?php echo TEMPLATE_DIR; ?>/ie56.css" rel="stylesheet" type="text/css" media="screen" /><![endif]-->

</head>

<body>



Apart from anything else, I'd made a transcription error in the example I gave at the top of this thread, placing "if" outside the square brackets at the beginning of the IE conditional call! I had this correct in my actual code, but it still wasn't working. The code above works perfectly.
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!