我对网页设计比较陌生,但据我了解,em 应该可以缩放到任何屏幕尺寸。除了一些琐碎的边框外,我将所有东西都定义为 em 或 %,但是,当我尝试在不同的屏幕上查看它时,没有 div 或它们的内容缩放。
我究竟做错了什么?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Name</title>
<link rel="stylesheet" href="css/style2.css" type="text/css">
</head>
<body>
<div id="Center">
<div id="home1">
<img src="WelcomeScreen.jpg" alt="Welcome!"/>
</div>
</div>
<div id="Left">
<div class="button1" id="a1">
</div>
<div class="button1" id="a2"></div>
<div class="button1" id="a3"></div>
</div>
<div id="Right">
<div class="button1" id="a4"></div>
<div class="button1" id="a5"></div>
<div class="button1" id="a6"></div>
</div>
</body>
</html>
@charset "utf-8";
/* CSS Document */
div{
display: inline-block;
}
div img{
height: auto;
width: 100%;
border: 3px solid black;
border-radius: 2em;
}
#home1{
position: relative;
border: 1px solid black;
border-radius: 2em;
margin-top: 4em;
left: 50%;
margin-left: -25em;
width: 50em;
height: 37.5em;
box-shadow: 0em 0em 5em 2em #000000;
}
.button1{
height: 10em;
width: 15em;
border: 1px solid black;
border-radius: 1em;
}
#a1{
position: relative;
margin-top: 1em;
margin-left: 1em;
}
#a2{
position: relative;
margin-top: 6em;
margin-left: 1em;
}
#a3{
position: relative;
margin-top: 6em;
margin-left: 1em;
}
#a4{
position: relative;
margin-top: 1em;
margin-right: 2em;
}
#a5{
position: relative;
margin-top: 6em;
margin-right: 2em;
}
#a6{
position: relative;
margin-top: 6em;
margin-right: 2em;
}
#Center{
height: 50em;
width: 60em;
padding: 0.8em;
border: 1px solid black;
left: 50%;
}
#Left{
float: left;
height: 50em;
width: 16em;
padding: 1em;
border: 1px solid black;
}
#Right{
align-content: center;
float: right;
height: 50em;
width: 16em;
padding: 1em;
border: 1px solid black;
}