Add Conditional Styles in WordPress theme

A Standard Conditional IE comment looks like this
<!--[if lt IE 9]>
<link href="style.css" rel="stylesheet" type="text/css" />
<![endif]-->

You can easily code this in your header.php file and it will work fine but it’s not a good practice to do so. A better option is to use the functions and hooks provided by WordPress. You can add the following code to your functions.php file

add_action( 'wp_enqueue_scripts', 'enqueue_conditional_style' );
function enqueue_conditional_style() {

global $wp_styles;
$wp_styles->add(‘example_ie7-‘, ‘/themes/example/ie7-.css’);
$wp_styles->add_data(‘example_ie7-‘, ‘conditional’, ‘lte IE 7’);
$wp_styles->enqueue(array(‘example_ie7-‘));

}