首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >转换宽度为1920px的布局时优化容器和排版

转换宽度为1920px的布局时优化容器和排版
EN

Stack Overflow用户
提问于 2020-09-27 04:07:19
回答 1查看 20关注 0票数 0

大家好,我想问一下,我有困难转换的设计文件1920px宽的布局到html。如何在响应时优化容器和排版。我希望字体大小和行高在调整大小时缩小。谢谢

EN

回答 1

Stack Overflow用户

发布于 2020-09-27 15:30:04

您好,您可以试试这个:

代码语言:javascript
复制
<!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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64082053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档