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

  • 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

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

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