DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Set Width And Padding Without Ccs Browser Hack

09.25.2006
| 6525 views |
  • submit to reddit
        // firefox an internet explorer handle padding in div-elements with width differently
// you don't need a css browser hack, you can use two div-elements insteas
// the outer-div handles width
// the inner div handles padding

//html
<div id="left_text">
	<div class="paddingbox">
		<p>loem ipsum dolor ...</p>
	</div>
</div><!--left_text-->

//css
//padding: top right, bottom, left;
#left_text {
	width: 208px;
	float: left;
}
div.paddingbox {
	padding: 4px 8px 4px 8px;
}