【发布时间】:2016-05-25 21:20:11
【问题描述】:
我有我的代码,我希望两个 div 组合在一起,但它不起作用。 .nav 标签为 10% 宽,内容为 90% 宽。所以他们应该适合在一起。感谢您的帮助。
这是我的 HTML 和 css:
.hf {
text-align: center;
background-color: blue;
color: white;
clear: both;
padding: 5px;
}
.nav {
width: 10%;
padding: 5px;
border-style: solid;
background-color: orange;
line-height: 200%;
float: left;
display: inline-block;
margin: 0px;
padding: 0px;
}
.content {
width: 90%;
float: left;
background-color: yellow;
padding: 0px;
display: inline-block;
margin: 0px;
}
<!DOCTYPE html>
<html>
<head>
<title>Basic Layout</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div class="hf">
<h2>Heading</h2>
</div>
<div class="nav">
<a href="#">Home</a><br>
<a href="#">Home</a><br>
<a href="#">Home</a><br>
<a href="#">Home</a><br>
<a href="#">Home</a><br>
<a href="#">Home</a><br>
<a href="#">Home</a><br>
<a href="#">Home</a><br>
<a href="#">Home</a><br>
</div>
<div class="content">
<h3>Content</h3>
<p>The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.</p>
</div>
</body>
这里
【问题讨论】:
标签: html css percentage