HTML forms / CSS - should “position” be on the enclosing DIV or the enclosed control?

无人久伴 提交于 2019-12-24 02:17:18

问题


Which is correct?

<div class="TEdit" id="Edit1" style="position: absolute; left: 200px; top: 100px;">
    <input type="text" name="Edit1" value="an edit bx">
</div>

or

<div class="TEdit" id="Edit1" >
    <input type="text" style="position: absolute; left: 200px; top: 100px;" name="Edit1" value="an edit bx">
</div>

see also related question I have a basic problem understanding CSS positioning


回答1:


First one is correct because div is parent tag:

<div class="TEdit" id="Edit1" style="position: absolute; left: 200px; top:  
 100px;"><input type="text" name="Edit1" value="an edit bx"></div>



回答2:


First one is correct.

Position should given to the DIV not onlt because it is a parent tag but also it's a content tag.



来源:https://stackoverflow.com/questions/3226799/html-forms-css-should-position-be-on-the-enclosing-div-or-the-enclosed-con

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!