Why removing float:left affects dimensions of a li element?
Posted: 28 October 2009 07:56 PM   [ Ignore ]
Newbie
Rank
Total Posts:  3
Joined  2009-08-11

Why removing float:left affects dimensions of a li element?
The cod is simple:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
 <
head>
 <
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <
titleHorizontal menu </title>
<
style type="text/css">
*
{     margin:0;
    
padding:0}
.menu {
    
list-style-type:none;
    
margin:50px;
}
.menu li{
    display
:inline;
    
font-size:18px;
    
line-height:36px;
}
.menu li a {
    float
:left;
    
margin:0 7px 0 0;
    
text-align:center;
    
width:100px;
    
height:36px;
    
color:#008080;
    
text-decoration:none;
    
background:#ffe8ff;
    
border:1px solid red;
}
ul
.menu li a:hover {
    color
:#c60000;
    
background:#a4ffff;
}
</style>
 </
head>

 <
body>        
        <
ul class="menu">
              <
li><a href="#">About</a></li>
            <
li><a href="#">Servises</a></li>
            <
li><a href="#">Solutions</a></li>
        </
ul>
 </
body>
</
html
Profile
 
 
Posted: 01 November 2009 09:21 AM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  9
Joined  2009-04-09

Hi,
Anchors are inline elements by default, when you float any element it generates a block box which is capable of taking dimensions. When you removed the float you lost your dimensions on the anchor.

Profile