CSS初学者在这里。正如您从代码中看到的那样,我希望“简介”和“内容”与顶部的距离相同,但“简介”会自行下降。
这是输出的屏幕截图:
代码
<!DOCTYPE html>
<html>
<head>
<style rel="stylesheet" type="text/css">
body {
background: #e7e6e1;
font-family: Georgia, 'Times New Roman';
font-size: 16px;
line-height: 150%;
color: #333;
}
index {
display: block;
margin: 20px;
font-size: 25px
}
h1 {
color: #0E0B06;
font-weight: normal;
margin-bottom: 0px;
}
h2 {
color: #0E0B06;
font-size: 15px;
font-weight: normal;
margin-bottom: 0px;
}
a {
color: #333;
text-decoration: none;
padding: 1px 2px;
background: #A3A3A1;
}
a:hover {
color: #0E0B06;
background: none;
}
.wrapper {
width: 520px margin: auto;
}
.header {
display: block;
margin: 30px 50px 75px 400px;
}
.indexer {
display: block;
margin: 70px 50px 75px 70px;
}
.poster {
display: block;
margin: 70px 50px 75px 400px;
padding-bottom: 30px;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="header">
<h1><a href="main.html">Web Server</a></h1>
<h2>Internet and Web Technology Assignment <br> by <b>Juhi Aswani</b> and <b>Kartikey Kushwaha</b></h2>
</div>
<div class="indexer">
<h2><b><font size="5px">Contents</font></b></h2>
<br>Introduction
<br>History
<br>Common features
</div>
<div class="poster">
<h2><b><font size="5px">1. Introduction</font</b></h2>
</div>
</div>
</body>
</html>