http://jsfiddle.net/C2LAV/
I'm attempting to make the design fill the whole screen unless it exceeds 30% of the total screen width. Then, if it exceeds the 30%, it should center align. W开发者_StackOverflowhy isn't it doing so?
updated version, still not working: http://jsfiddle.net/C2LAV/5/
You're trying to use headerObj
, which isn't defined, you need something like:
var headerObj = document.getElementById("header");
You can test it out here. For the other piece, the actual centering, you just need to set the margin
, like this:
contentObj.style.margin = "0 auto";
You can test that out here.
精彩评论