【发布时间】:2015-11-03 23:42:52
【问题描述】:
我编写这段代码是为了了解下面代码的边距、填充和位置。问题在这些 /* */ 之间。再次感谢。
<!DOCTYPE html>
<html>
<head>
<style>
html{
width:auto; /* Does auto will apply the background-color automatically to the display screen */
height:100%; /* 100% means 100% of the display browser??*/
margin-left:1%; margin-right:1%; /*does changing the value of the margin will change anything in the page*/
margin-top:1%;margin-bottom:1%;
padding-left:1%;padding-right:1%;
padding-top:1%;Padding-bottom:0%;
border: 1px solid black;
background-color: red;
}
body{
background-color: #00FF00;
width:50%; /* does it means 50% of the width stated above in the html (auto)*/
height:50%; /*does it means 50% of the height of the display browser or we have to add the padding-top(1%) in html*/
position: fixed;
top: 25%; /* does it mean that the body is shifted to below 25% of it's heigh or 25% of the display browser? */
left:25%; /* what is the different if i give 0% to left and i changed the margin-left value to 25%*/
border: 2px solid black ;
margin-top: 0px;
margin-left: 0px;}
header{width:50%;height:auto;
top: 25%;left:25%; /* what does it mean here the value given to top and left??*/
border: 2px solid black ;
margin-top: 10%;
margin-left: 25%;}
h1{margin: 5px; color: blue;}
</style>
</head>
<body>
<header>
<h1> MY First webpage </h1>
</header>
</body>
</html>
【问题讨论】: