开发者

Why isn't this design center aligning?

开发者 https://www.devze.com 2023-02-01 02:29 出处:网络
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开发者_Stack

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消