Jump to content

<!--[if lte IE 8 ]--> ELSE?


confused and dazed

Recommended Posts

Hello internet.

 

I am starting to work with media Querys (like ones below):

@media screen and (max-width : 460px) { .someclassname {display: block;} }

 

I am struggling to style IE10 browsers and below (I anticipate half of my users will be IE folks) because the media querys will not work for them. I can use the conditional statement below but the browser will still attempt to put the rest of the code on the page making it look all screwed up:

<!--[if lte IE 8 ]>

SOME CODE

<![endif]-->

A BUNCH MORE CODE

 

How do I use html conditional statements to get rid of “A BUNCH MORE CODE” on the site?

Link to comment
Share on other sites

http://www.quirksmode.org/css/condcom.html

<!DOCTYPE html><head lang="en"><meta charset="utf-8"><title>IE conditionals</title><!--[if !IE]> --><style>/* this style block is not for IE */p{ color:green;}</style><!-- <![endif]--><!--[if IE]><style>/* this style block is for IE */p{ color:red;}</style><![endif]--></head><body><p>Hello: RED if IE -- GREEN if not IE</p></body></html>
Edited by davej
Link to comment
Share on other sites

<!--[if !IE]> -->

 

...But I think the more traditional approach is to apply a universal style and then apply IE fixes as overrides...

<link rel="stylesheet" href="normal-styles.css" type="text/css" /><!--[if IE 9]><link rel="stylesheet" href="ie9-fixes.css" type="text/css" /><![endif]--><!--[if lte IE 8]><link rel="stylesheet"  href="ie5678-fixes.css" type="text/css" /><![endif]-->
Edited by davej
Link to comment
Share on other sites

<link rel="stylesheet" href="normal-styles.css" type="text/css" /><link rel="stylesheet" href="ie9-fixes.css" type="text/css" /><link rel="stylesheet" href="ie5678-fixes.css" type="text/css" />Where do you get these files?

they were examples to illustrate his point for each condition...

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...