Home  >  Article  >  Web Front-end  >  为什么我的div和父div不上对齐_html/css_WEB-ITnose

为什么我的div和父div不上对齐_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:40:451027browse

div

http://primetouchandfeel.com/enquiry
这个地址有一个表单,Enquiry和Security Code总是和父div下对齐,我要上对齐,我已经用了margin-top,padding-top为0,还是不行。

回复讨论(解决方案)

既然 父div是 相对定位 ,那  他俩就应该用 绝对定位啊 这样试试看:.lable{position:absolute;top:xxx,left:xxxx}

因为你后面的DIV用的是inline-block

加一个vertical-align: top;就好了。原因就是inline-block会使元素向下对齐。这和padding-top,margin-top没有关系的。使用浮动就不会有这种情况了,当然会带来浮动清理问题。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn