开发者

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

开发者 https://www.devze.com 2023-01-06 23:42 出处:网络
Which is correct? <div class=\"TEdit\" id=\"Edit1\" style=\"position: absolute; left: 200px; top: 100px;\">

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" v开发者_StackOverflow中文版alue="an edit bx">
</div>

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


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>


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.

0

精彩评论

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