文本对齐:中心;不起作用 [英] text-align:center; doesn't work
问题描述
我一直在搞乱我的网站布局和我的 text-align:center;
停止工作
,这是在我设置所有div的位置后发生的相对来说,当我使用javascript向组件添加组件时,父div会发生变化。
以下是我的两个CSS文件:
您可以在下面的JSfiddle链接中看到新的CSS文件。
jsFiddle: http://jsfiddle.net/2WvrV/ 我也提供旧网站的代码(正确对齐文本): http://jsfiddle.net/fiddlerOnDaRoof/fQpjX/ 旧的HTML与新版本非常相似,我只是添加了style =float:left;在其中一个div中解决方案
loginBttn
div
添加
clear:left;
之后,一切工作正常
感谢您试图帮助每个人
I have been messing around with the layout of my website and my text-align : center;
stopped working
that happened after i set all my divs position to relative to make the parent div change size when I add components to it with javascript.
Here are both of my CSS files:
You can see the new one in the JSfiddle link below.
jsFiddle: http://jsfiddle.net/2WvrV/
I also provide the code for the old website (which aligns the text properly) :
http://jsfiddle.net/fiddlerOnDaRoof/fQpjX/
the old HTML is very similar to the new version i just added the style="float:left;" in one of the divs
Finally figured it out. All i needed to do is to add
clear:left;
to my loginBttn
div
after that everything worked fine
thanks for trying to help everybody
这篇关于文本对齐:中心;不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!