Jump to content

Using conditional statement in external css


rogerio

Recommended Posts

This only works if added to the .html, how can I get this to work in an external .css?

<style type="text/css">/* Remove margins from the 'html' and 'body' tags, and ensure the page takes up full screen height */html, body{    height:100%;    margin:0;    padding:0;    color:white;}/* Set the position and dimensions of the background image. */#page-background{    position:fixed;    top:0;    left:0;    width:100%;    height:100%;}/* Specify the position and layering for the content that needs to appear in front of the background image. Must have a higher z-index value than the background image. Also add some padding to compensate for removing the margin from the 'html' and 'body' tags. */#content{    position:relative;    z-index:1;    padding:10px;}#footer{    font-size:small;    text-align:center;}</style><!-- The above code doesn't work in Internet Explorer 6. To address this, we use a conditional comment to specify an alternative style sheet for IE 6 --><!--[if IE 6]><style type="text/css">html{    overflow-y:hidden;}body{    overflow-y:auto;}#page-background{    position:absolute;    z-index:-1;}#content{    position:static;    padding:10px;}</style><![endif]-->

Edited by rogerio
Link to comment
Share on other sites

Insert css styling for ie6 in separate style sheet IE6crap.css then use

<link rel="stylesheet" href="pathtocss/normalbetter.css" type="text/css" /><!--[if IE 6]><link rel="stylesheet" href="pathtocss/IE6crap.css" type="text/css" /><![endif]-->

below stylesheet link to normal stylesheet styling

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...