HTML表单/ CSS - 应该“位置”在封闭的DIV或封闭的控制? [英] HTML forms / CSS - should "position" be on the enclosing DIV or the enclosed control?

查看:118
本文介绍了HTML表单/ CSS - 应该“位置”在封闭的DIV或封闭的控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是正确的?

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

<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

推荐答案

第一个是正确的,因为div是父标记:

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>

这篇关于HTML表单/ CSS - 应该“位置”在封闭的DIV或封闭的控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆