我是网页设计的初学者,我使用 html 和 css 开发了一个页面。我想将我的静态页面转换为响应式,以便每当我重新调整浏览器大小时,我的页面样式都会根据窗口大小保持不变。 下面是我的 body 宽度和高度。
body{
width:100%;
height:100%;
margin:0%;
background-color:white;
}
现在,每当我尝试重新调整浏览器窗口的大小时,我的页面样式就不会保持不变。div 会相互折叠。
请给我一些简单的提示,以将我的页面转换为响应式。
最佳答案
body {
background-color: lightpink;
}
@media screen and (max-width: 420px) {
body {
background-color: lightblue;
}
}
<body>
<p>If screen size is less than 420px, then it will show lightblue color, or else it will show light pink color</p>
</body>
关于html - 使静态页面响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36193674/