日期:2014-05-16  浏览次数:20521 次

html 中div的位置问题
我写了个菜单,然后菜单里有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>
html

------解决方案--------------------
<div id=页面1 style="position:absolute;left:50px;Top:10px;margin-top: 10px;margin-left:&nb