IE 7 and 8 Not Showing Perfect Design View [WordPress]

I absolutely hate IE, specially versions 6, 7 and 8. When you are designing a wordpress theme, you have to style it twice, once for proper browsers and then for the IE ancients. The other big thing to remember, these ancients don’t have support for media queries.

So to solve your problem, create a stylesheet called ie.css. You will use this to do all your styling for IE 7 and 8.

Next you will need to enqueue that stylesheet, but we will enqueue it conditionally. This stylesheet will only load for IE versions up to IE8. So in your functions.php, add the following

[php]function enqueque_ie_stylesheet() {
// Load the Internet Explorer specific. stylesheet.
wp_enqueue_style( ‘style-ie’, get_template_directory_uri() . ‘/ie.css’, array(), ” );
wp_style_add_data( ‘style-ie’, ‘conditional’, ‘lt IE 9’ );
}
add_action( ‘wp_enqueue_scripts’, ‘enqueue_ie_stylesheet’ );[/php]

You can now add your styles in ie.css. Just remember to change get_template_directory_uri to get_stylesheet_directory_uri if you are using a child theme.

[custom-related-posts title=”You may Also Like:” none_text=”None found” order_by=”title” order=”ASC”]

Leave a Comment