【发布时间】:2014-03-03 17:14:53
【问题描述】:
我只是在学习,我正在尝试将 4 div 的布局设置为我想要的页面大小(而不是用户窗口打开到的任何大小)。基本问题,但我不能让我的右 div 附加到左 div 而不一定是用户窗口的右侧。
这是我的代码,提前谢谢你。
HTML:
<!DOCTYPE html>
<html>
<head>
<title>all.about.me</title>
<link rel='stylesheet' type='text/css' href='me_stylesheet.css'/>
</head>
<body>
<div id="header">
<p>March 02, 2014
<br><br>Hello.
<br>
</p>
</div>
<div id="left"> </div>
</div>
<div id="right"> </div>
<div id="footer">
</a>
</div>
</body>
</html>
CSS:
p
{
font:10px verdana,sans-serif;
color: white;
padding-left: 10px;
padding-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
body
{
background-color: red;
}
div {
border-radius: 0px;
}
#header {
height: 80px;
width: 600px;
background-color: black;
margin-bottom: 5px;
}
#footer {
height: 35px;
width: 600px;
background-color: black;
margin-bottom: 5px;
clear: both;
}
#left {
height: 385px;
width: 122px;
background-color: black;
float: left;
margin-right: 5px;
margin-bottom: 5px;
}
#right {
height: 385px;
width: 300px;
background-color: black;
float: right;
margin-right: 5px;
margin-bottom: 5px;
}
我知道这是一个基本问题,我可能会在 Google 上找到答案,但你们这里的编码人员总是有不同且独特的做事方式,这确实激发了创造性编码。感谢您的帮助。
【问题讨论】:
-
将元素包裹在一个固定的
width容器元素中 -
无法理解您的问题。能说清楚一点吗?
标签: css html css-float right-align