大家好,我想问一下,我有困难转换的设计文件1920px宽的布局到html。如何在响应时优化容器和排版。我希望字体大小和行高在调整大小时缩小。谢谢
发布于 2020-09-27 15:30:04
您好,您可以试试这个:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.example {
padding: 20px;
color: white;
}
/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
.example {font-size:0.8rem;line-height:28px}
}
/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
.example {font-size:0.9rem;line-height:28px}
}
/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {
.example {font-size:0.95rem;line-height:28px}
}
/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
.example {font-size:1rem;line-height:28px}
}
/* Extra large devices (large laptops and desktops, 1920px and up) */
@media only screen and (min-width: 1920px) {
.example {font-size:1rem;line-height:28px}
}
</style>
</head>
<body>
<h2>Typical Media Query Breakpoints</h2>
<p class="example">Resize the browser window to see how the background color of this paragraph changes on different screen sizes.</p>
</body>
</html>https://stackoverflow.com/questions/64082053
复制相似问题