开发者

CSS margin and values

开发者 https://www.devze.com 2023-03-22 19:48 出处:网络
Last day I asked a question开发者_StackOverflow中文版 and someone answered that I want, it is here: http://jsfiddle.net/dmrc1143/Cf2k8/

Last day I asked a question开发者_StackOverflow中文版 and someone answered that I want, it is here: http://jsfiddle.net/dmrc1143/Cf2k8/

According to it I started to do my CSS. But I cannot put my wrapper_top to center. Everytime It must be center. What is wrong in my attempt: http://jsfiddle.net/dmrc1143/VK23u/ (forget ASP.NET elements.)

My second question: I used float:right; and how can I do without float:right; ? And is float:right; bad? I read somewhere It shows you are a beginner, is it right?


As far as I know, centering via margin: auto; works only for static positioned elements. You can check by simple erasing the line position: fixed; which should give you the desired result. A possible solution to apply it on fixed positioned elements would be to center via left: 50% and margin-left to half of the element's size.

0

精彩评论

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