javascript
Brief description  about Online courses   join in Online courses
View Ravi  Kanth 's Profile

CSS code works in IE but not in Crome or Firefox

<html>
<head>
<title> CSS Example </title>
<style type="text/css">


#mainpage{
margin: 5px;
padding: 10px;
border: 2px solid #7E587E;
width: 100%;
height: 100%;
background-color: #C8BBBE;
}

#introbox{
padding: 10px;
width:100%;
height: 10%;
border: 1px solid #461B7E;
background-color: #EBDDE2;
text-align: center;
font-size: 40px;
}

.lineheight30{
line-height: 30px;
}

#maxheight50{
margin-top:5px;
padding: 5px;
max-height: 50%;
width: 100%;
border: 1px solid #461B7E;
background-color: #EBDDE2;
font-size: 20px;
font-family: calibri;
}

#minheight20{
margin-top: 5px;
padding: 5px;
min-height: 20%;
width: 100%;
border: 1px solid #461B7E;
background-color: #EBDDE2;
}

#maxheight{
margin-top: 5px;
margin-right: 5px;
padding: 5px;
max-height: 30%;
width: 45%;
border: 1px solid #461B7E;
background-color: #EBDDE2;
float: left;
}

#minwidth{
margin-top:5px;
margin-right:5px;
padding: 5px;
border: 1px solid #461B7E;
background-color: #EBDDE2;
height: 10%;
min-width: 45%;
float: right;
font-style: italic;

}



</style>
</head>

<body>
<div id="mainpage">
<div id="introbox">
Width and Height properties in CSS
</div> <!--introbox div ends -->
<div id="maxheight50">
<span class="lineheight30"> <p> This is an example of a div with max height of 50% </p>


<p></p>
</span>
</div> <!-- maxheight50 div ends -->


<div id="minheight20">
<p> This is an example of a div with minimum height of 20% </p>



</div> <!--minheight div ends here -->

<div id="maxheight">
<ul> <li> Width </li>
<li> Min-width </li>
<li> Max-width </li>
<li> Height </li>
<li> Min-height </li>
<li> Max-height </li>
<li> Line-Height </li>

</ul>
</div> <!-- leftmenu div ends-->

<div id="minwidth">
<p> This is an example of a div with minimum width of 45% </P>
</div> <!--minwidth div ends -->

</div> <!-- Mainpage div ends -->
</body>




Asked by Ravi Kanth | May 31, 2012 |  Reply now
Replies (2)
View ravi kanth 's Profile
thank you, but since i have no control on which browser user will use, how do i write a code to link these stylesheet so that the correct stylesheet is selected depending on which browser user selects
Jun 5, 2012
View teacher siliconindia 's Profile
Hi
While designing only you need to take care small things like changing width, padding, margin,

After that also if not fixed you can write different style sheet for that


<link href="homeoutside/formozilla.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<link href="homeoutside/forie.css" rel="stylesheet" type="text/css" />
<![endif]-->

<!--[if IE 7]>
<link href="homeoutside/forie7.css" rel="stylesheet" type="text/css" />
<![endif]-->

Like this

Regards
Jun 3, 2012