Forum Moderators: not2easy
CSS::
.menutitle
{
cursor: pointer;
width: 90px;
border: 1px solid #dcd600;
background-color: #000000;
margin: 2px;
text-align:center;
font-weight:bold;
color: #dcd600;
display: inline;
}
.menutitle a:link, .menutitle a:visited
{
width: 90px;
background-color: #000000;
color: #dcd600;
text-decoration: none;
display: inline;
}
.menutitle a:hover
{
width: 90px;
background-color: #101010;
color: #dcd600;
text-decoration: none;
display: inline;
}
HTML sample::
<div class="menutitle"><a href="main.html">Home</a></div>
Width does not apply to inline elements. Make your links display: block.
[edited by: tedster at 11:10 pm (utc) on Mar. 15, 2004]
[edit reason] Sorry, no personal URLs. See TOS [/edit]
thanks for the validator and info rogerdp!
Try this code:
<style type="text/css" media="screen"><!--
#menu ul {
border: 0;
margin: 0;
padding: 0;
list-style-type: none;
text-align: center;
}
#menu ul li {
display: block;
float: left;
text-align: center;
padding: 0;
margin: 0;
}
#menu ul li a {
width: 90px;
border: 1px solid #dcd600;
background: #000;
margin: 2px;
padding: 0;
font-weight: bold;
color: #dcd600;
display: block;
text-align: center;
text-decoration: none;
}
#menu ul li a:hover {
background: #999990;
color: #dcd600;
text-decoration: none;
}
--></style>
HTML:
<div id="menu">
<ul>
<li><a href="main.html">Home</a></li>
<li><a href="main.html">Home</a></li>
<li><a href="main.html">Home</a></li>
</ul>
</div>
Kind regards
david
[edited by: Bonusbana at 11:06 pm (utc) on Mar. 15, 2004]
See [w3.org...] , specifically the "applies to" part.
Consider this:
#wrap {
margin: 0 auto;
width: 288px;
padding: 0;
}
#menu ul {
border: 0;
margin: 0;
padding: 0;
list-style-type: none;
text-align: center;
}
#menu ul li {
display: block;
float: left;
text-align: center;
padding: 0;
margin: 0;
}
#menu ul li a {
width: 90px;
border: 1px solid #dcd600;
background: #000;
margin: 2px;
padding: 0;
font-weight: bold;
color: #dcd600;
display: block;
text-align: center;
text-decoration: none;
}
#menu ul li a:hover {
background: #992;
color: #dcd600;
text-decoration: none;
}
<html>
<body>
<div id="wrap">
<div id="menu">
<ul>
<li><a href="main.html">Home</a></li>
<li><a href="main.html">Home</a></li>
<li><a href="main.html">Home</a></li>
</ul>
</div>
</div>
</body>
</html>
Now, the wrap width is 288px because the three menu items + margins & borders: 90+90+90+2+2+2+2+2+2+1+1+1+1+1+1. Please note that you will need some hack to make the width display correct in IE5/win, because IE5/win does not count borders or padding in the total width. Try the box model hack:
#wrap {
margin: 0 auto;
padding: 0;
width: 288px;
voice-family: "\"}\""; */ box model hack */
voice-family:inherit;
width: 282px;
}
/* opera hack */
html>#wrap {
width: 282px;
}
I dont know if there is an easier way at the moment, sorry.