spk
12-26-2002, 08:15 PM
New to advanced css, but not HTML. Thanks in advance for your replies.
I've read about the "box" (content, padding, border, margin). I don't understand two things in my examples below.
1. Why do the border and padding for my .menuButton extend outside the <div>? I would think the <div> would fully contain the content inside it. I've set the <div> background to gray and the menuButtons extend outside the gray.
2. Why does the <td> seem to clip the top/bottom border and padding from the anchor? Shouldn't the <td> expand to fully contain the anchor, its padding and borders?
Thanks for your replies.
<html>
<head></head>
<body bgcolor="ffffff">
<p></p>
<style type="text/css">
.menuBar {
background-color: gray;
border: 3px solid;
border-color: #ff0000;
padding: 0px;
text-align: left;
}
.menuButton {
color: #000000;
background-color: #68699f;
font-family: verdana, arial, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: bold;
border: 1px solid;
border-color: #f0f0f0 #909090 #909090 #f0f0f0;
cursor: default;
padding: 12px 16px 12px 16px;
text-decoration: none;
}
.menuButton:hover {
background-color: #0000ff;
border-color: #f0f0f0 #909090 #909090 #f0f0f0;
color: #000000;
}
</style>
<div class="menuBar">
<a class="menuButton" href="">Button 1</a>
<a class="menuButton" href="">Button 2</a>
<a class="menuButton" href="">Button 3</a>
<a class="menuButton" href="">Button 4</a>
</div>
<p></p>
<table>
<tr>
<td class="menuBar">
<a class="menuButton" href="" ...>Button 1</a>
<a class="menuButton" href="" ...>Button 2</a>
<a class="menuButton" href="" ...>Button 3</a>
<a class="menuButton" href="" ...>Button 4</a>
</td>
</tr>
</table>
</body>
</html>
I've read about the "box" (content, padding, border, margin). I don't understand two things in my examples below.
1. Why do the border and padding for my .menuButton extend outside the <div>? I would think the <div> would fully contain the content inside it. I've set the <div> background to gray and the menuButtons extend outside the gray.
2. Why does the <td> seem to clip the top/bottom border and padding from the anchor? Shouldn't the <td> expand to fully contain the anchor, its padding and borders?
Thanks for your replies.
<html>
<head></head>
<body bgcolor="ffffff">
<p></p>
<style type="text/css">
.menuBar {
background-color: gray;
border: 3px solid;
border-color: #ff0000;
padding: 0px;
text-align: left;
}
.menuButton {
color: #000000;
background-color: #68699f;
font-family: verdana, arial, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: bold;
border: 1px solid;
border-color: #f0f0f0 #909090 #909090 #f0f0f0;
cursor: default;
padding: 12px 16px 12px 16px;
text-decoration: none;
}
.menuButton:hover {
background-color: #0000ff;
border-color: #f0f0f0 #909090 #909090 #f0f0f0;
color: #000000;
}
</style>
<div class="menuBar">
<a class="menuButton" href="">Button 1</a>
<a class="menuButton" href="">Button 2</a>
<a class="menuButton" href="">Button 3</a>
<a class="menuButton" href="">Button 4</a>
</div>
<p></p>
<table>
<tr>
<td class="menuBar">
<a class="menuButton" href="" ...>Button 1</a>
<a class="menuButton" href="" ...>Button 2</a>
<a class="menuButton" href="" ...>Button 3</a>
<a class="menuButton" href="" ...>Button 4</a>
</td>
</tr>
</table>
</body>
</html>