Saturday 21 April 2012

How to write conditional statement in CSS?


How to write conditional statement in CSS?



Following is the example of conditional statement in CSS.

 <head>

        <style type="text/css">

           body

            {

                color:blue;

            }

        </style>

        <!--[if IE 7]>

        <style type="text/css">

        body {

            background-color:red;

        }

        </style>

        <![endif]-->

 </head>


If this code will run in IE7 browser, the background color of the page will be red, for other browser it will be default color (white).

No comments:

Post a Comment