【发布时间】:2021-07-08 07:36:14
【问题描述】:
我写信是想在我编码的时候留下一个关于我的代码的问题。
我正在将网站的导航设计转换为代码。如果您查看作为图像附加的网站导航布局设计,则有 10 行和 8 列。于是我就这样写了代码。
我认为的问题是没有任何文字,10%的高度设置值没有体现出来。我想请你帮忙解决这个问题的位置和方法。
另外,我不是编码专家,所以如果你能用具体的代码测试回答我,我将不胜感激。
提前感谢您的帮助。
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
box-sizing: border-box;
}
body {margin-top: 0; margin-left: 0; margin-right: 0;}
/* Create four equal columns that floats next to each other */
.column {
float: left;
width: 12.5%;
padding: 0;
height: 10%/* Should be removed. Only for demonstration */
}
.logo {
float: left;
width: 12.5%;
padding: 0;
height: 20%/* Should be removed. Only for demonstration */
}
.column2 {
float: right;
width: 87.5%;
padding: 0;
margin: 0;
height: 10%; /* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
margin-top: 0;
}
</style>
</head>
<body>
<div class="row">
<div class="logo" style="background-color:#aaa;">
<h2>Column 1</h2>
</div>
<div class="column" style="background-color:#bbb;">
<h2>Column 2</h2>
</div>
<div class="column" style="background-color:#ccc;">
<h2>Column 3</h2>
</div>
<div class="column" style="background-color:#ddd;">
<h2>Column 4</h2>
</div>
<div class="column" style="background-color:#ddd;">
<h2>Column 5</h2>
</div>
<div class="column" style="background-color:#ddd;">
<h2>Column 6</h2>
</div>
<div class="column" style="background-color:#ddd;">
<h2>Column 7</h2>
</div>
<div class="column" style="background-color:#ddd;">
<h2>Column 8</h2>
</div>
<div class="column2" style="background-color:#ddd;">
<h2>Column 8</h2>
</div>
</div>
</body>
</html>
【问题讨论】:
标签: html css html-table navigation