Jump to content

Alternate CSS in IE7?


ned.adams

Recommended Posts

Hello, I have a site that has tables in it. When I print to a printer the tables look very bad. I am trying to setup an alternate style sheet that will strip the bad looking tables out and print only the content. Does anyone have a good tutorial that works in both IE7 and Firefox, or suggestions on how to do this?Thanks in advance!

Link to comment
Share on other sites

Hello, I have a site that has tables in it. When I print to a printer the tables look very bad. I am trying to setup an alternate style sheet that will strip the bad looking tables out and print only the content. Does anyone have a good tutorial that works in both IE7 and Firefox, or suggestions on how to do this?Thanks in advance!
I've tested this and it works:
<link rel="stylesheet" type="text/css" href="css/main.css" media="screen, projection"/>    <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen, projection" href="tyle_IE.css" /><![endif]-->    <!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen, projection" href="css/ie7.css" /><![endif]--></head><body>

You'll then put any changes to the css code in those alternate css files, while the bulk of your code will go in your main css file. Also notice in my code that I've placed my css files in a special folder - so change the uri if your directory structure is different.

Link to comment
Share on other sites

What do those css files look like?

I've tested this and it works:
<link rel="stylesheet" type="text/css" href="css/main.css" media="screen, projection"/>    <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen, projection" href="tyle_IE.css" /><![endif]-->    <!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen, projection" href="css/ie7.css" /><![endif]--></head><body>

You'll then put any changes to the css code in those alternate css files, while the bulk of your code will go in your main css file. Also notice in my code that I've placed my css files in a special folder - so change the uri if your directory structure is different.

Link to comment
Share on other sites

For anyone who looks at this, that syntax is only for IE. So I just copied the print css without that condition and it worked for FireFox. Thanks for your help again!

So I jumped the gun a little bit. Now it doesn't work in FireFox. Is there a thing like <!--[if IE 7]><endif]--> for firefox?
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...