html 中div的位置问题

luyinglply luyinglply 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我写了个菜单,然后菜单里有button 、label,但是他们的位置不正确,麻烦帮忙看下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>窗体1</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var name = "";
$("#menu ul li a").each(function () {
$(this).click(function () {
name = $(this).attr("title");
$("#div2 div").each(function () {
$(this).attr("style", "background-color:" + name + ";display:none;");
if ($(this).attr("id") == name) {
$(this).attr("style", "background-color:" + name + ";");
}
})
});
});
});
</script>
<style>.div1{width:1006px;height:682px;float:left;}</style>
<style type="text/css">
#menu ul li { display:inline; float:left; margin-bottom:20px; }
#menu ul li a { padding:20px;text-decoration: none;}
.main { clear:both;width:10%; height:60px;margin-left:0px;}</style>
</head>
<body>

<div class="div1">


<div id=control5 style="position:absolute;top:153px;left:57px">


<div id="menu">
<ul>
<li ><a href="#" title=页面1>页面1</a></li>
<li ><a href="#" title=页面2>页面2</a></li>
</ul>
</div>

<div id="div2" class="main" >

<div id=页面1 style="display:none">
<div id=页面1 style="position:absolute;left:12px;Top:26px;">
<input type="button" name=按钮2 value=按钮2 style="width:75px;height:25px" >
</div>
<div id=页面1 style="position:absolute;left:50px;Top:10px;">
<input type="text" name=编辑框2 style="width:121px;height:19px"/>
</div>

</div>

</div>

</div>



</div>

</body>
</html>
...全文
评论 4
收藏 已收藏
分享
返回顶部
luyinglply
CSS 61,117 成员 60,701 内容