我正在尝试使具有类.column
的4列占据页面高度的100%,但是无法做到,并且我不知道原因。
body,
html {
margin: 0px;
padding: 0px;
font-family: Helvetica, sans-serif;
height: 100%;
width: 100%;
}
#header {
height: 40px;
width: 100%;
background-color: grey;
display: block;
}
#logo {
float: left;
font-size: 30px;
font-weight: bold;
padding-left: 15;
padding-top: 3px;
margin: 0 auto;
width: 10%;
}
#menu {
margin: 0 auto;
width: 50%;
height: 50%;
padding: 10px;
text-align: center;
}
#menu li {
display: inline;
border: 1px solid black;
border-radius: 15%;
background-color: red;
color: white;
}
#menu a {
text-decoration: none;
padding: 0 10px;
/* variable width */
}
a:hover {
background-color: black;
}
a:link,
a:visited,
a:active {
color: white;
}
.column {
top: 0;
left: 0;
margin: 0;
padding: 0;
width: 25%;
height: 100%;
float: left;
-webkit-box-shadow: inset 0px 0px 0px 1px black;
-moz-box-shadow: inset 0px 0px 0px 1px black;
box-shadow: inset 0px 0px 0px 1px black;
}
.clear-div {
clear: both;
}
<div id="header">
<div id="logo">
CodePlayer
</div>
<div id="menu">
<li><a href="#">HTML</a>
</li>
<li><a href="#">CSS</a>
</li>
<li><a href="#">JAVASCRIPT</a>
</li>
<li><a href="#">OUTPUT</a>
</li>
</div>
<div class="clear-div">
</div>
<div class="column" id="html">
This column needs to be 100% of the page's height
</div>
<div class="column" id="css">
This column needs to be 100% of the page's height
</div>
<div class="column" id="javascript">
This column needs to be 100% of the page's height
</div>
<div class="column" id="output">
This column needs to be 100% of the page's height
</div>
</div>
我是一名初学者,关于良好的网页开发实践方面的建议对我来说非常宝贵,因此如果有什么我做得不好的地方,请告诉我。