Reputation: 3
I want to align the fonts so that they appear at center while not increasing the maximum height of #nav li a above 60px. Please suggest a way. max-height didn't work in this case.
HTML
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
<ul id="nav">
<li><a href="#">Work</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</body>
</html>
CSS
#nav {
list-style-type: none;
margin: 0;
padding: 0;
}
#nav li {
width: 20%;
float: right;
text-align:center;
}
#nav li a {
height:60px;
display: block;
padding: 0.5em 5px 0.5em 5px;
text-decoration: none;
font-weight: bold;
color: #F2F2F2;
}
#nav a:link, #nav a:visited {
background-color: #071726;
}
#nav a:hover, #nav a:active, #nav a:focus {
background-color: #326773;
}
Upvotes: 0
Views: 100
Reputation: 842
Added a line-height
attribute to the nav links in your CSS. Check it out: http://jsfiddle.net/2xEz2/
Upvotes: 0