How Do You Write A Conditional Statement In CSS? Give An Example.

Conditional Statements in CSS code

        Conditional Statements in CSS code

<style type=”text/css”>
body
{
 color: #00BFFF;
}
</style>
<!—if [ IE 8] >
<style type=”text/css”>
body
{
 Background-color: #00FFBF;
}
</style>
<! [end if] -->

The above code snippet will change the background color to “00FFBF” if the browser is IE 8 or will have a default color if its other browsers.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *