[thelist] CSS padding, width in %

Erik Mattheis gozz at gozz.com
Tue Jul 20 01:16:09 CDT 2004


Perhaps my question is best explained in code:

.link1 { position: absolute;
	top: 0px;
	left: 20%;
	width: 20%;
}

.link2 { position: absolute;
	top: 0px;
	left: 40%;
	width: 20%;
}

.link1 a, .link2 a {
	display: block;
	width: 100%;
	padding: 4px; // <--- this is the problematic declaration
	border: 1px solid #000;
}

<div id="link1">This area extends under the next div</div>

<div id="link1">This area overlaps the previous div</div>

What I want are 5 divs, each of which are exactly 20% window with and 
spaced at 0%, 20%, 40%, 60% and 80% - works fine until I put padding 
around the links inside.

How can I have padding and retain the precise 20% width?


--
- Erik Mattheis
612 377 2272
http://gozz.com/



More information about the thelist mailing list