gpt4 book ai didi

嵌套 div 的 HTML 和 CSS 帮助

转载 作者:行者123 更新时间:2023-11-28 18:59:07 24 4
gpt4 key购买 nike

我正在做一个以学习为目的的元素。我在主 div 中获取左右 div 时遇到问题。如果有人能指出代码中的问题出在哪里,我们将不胜感激。谢谢

HTML代码

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<link href="template/css/test_css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="main_wrapper">
<div class="wrapper">
<div class="head"></div>
<div class="nav"></div>
<div id="main">
<div class="left">some data</div>
<div class="right">some data</div>
</div><!--end main-->
<div class="footer">
</div><!--end footer-->
</div><!--end wrapper-->
</div><!--end main_wrapper-->
</body>
</html>

CSS代码

@charset "utf-8";
/* CSS Document */

body,td,th {
font-family: Arial, Helvetica, sans-serif;
margin-top:0px;
background-color:#FF0000;
}

#main_wrapper {
width:950px;
margin:auto;
background-image: url(../images/bg_a.png);
background-repeat:repeat-y;
}


.wrapper {
background-color:#009900;
margin-left:5px;
margin-right:5px;
}
.head {
height:115px;
}

.nav {
height:30px;
}
#main {
padding:10px;
margin:5px;
background-color:#0099FF;
}
.left {
width:600px;
float:left;
}
.right {
width:300px;
float:right;
}
.footer {
height:50px;
}

最佳答案

试试这个:

   #main {
padding:10px;
margin:5px;
background-color:#0099FF;
overflow: hidden;
}

关于嵌套 div 的 HTML 和 CSS 帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6725391/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com