Created
October 20, 2010 06:04
-
-
Save POPOEVER/635852 to your computer and use it in GitHub Desktop.
Block element 100% width with padding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="robots" content="all" /> | |
<title>margin vs. padding</title> | |
<style type="text/css"> | |
<!-- | |
body { | |
margin:0; | |
padding:0; | |
} | |
#legend { | |
margin:0; | |
padding:0; | |
color:white; | |
background-color:#900; | |
} | |
#wrapper { | |
margin:0; | |
padding:0 20px; | |
width:remainder; | |
background-color:red; | |
} | |
#wrapper textarea { | |
margin:0; | |
padding:0; | |
width:100%; | |
border:0; | |
background-color:#b22; | |
color:white; | |
} | |
--> | |
</style> | |
</head> | |
<body> | |
<div id="legend">width:100%, automatically, without declaration</div> | |
<div id="wrapper"><textarea>width:100%, with parent div width:remainder</textarea></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment