I have a variable width header that must have a background color that is as wide as the text (no wider). The only way I can think of doing this (with no ext
you can give text-align:center;
to the body
as a global arrtibute & give display:inline-block
to your header
div. So,it's center your dynamic width
in center
like this :
CSS:
body{margin:0; padding:0;text-align:center}
p{text-align:left;}
.header{background:red;display:inline-block;}
Check this example http://jsfiddle.net/vpcXS/