简体   繁体   English

响应式网站,将正文设置为设备宽度

[英]Responsive Website, set body to device-width

在此处输入图像描述

I want the body of the page to be responsive so that it is easy for the user to read on a mobile site.我希望页面的正文具有响应性,以便用户在移动网站上轻松阅读。 But when I use this line of code.但是当我使用这行代码时。 I get this mess.我得到这个烂摊子。 Any suggestions?有什么建议么?

<meta name="viewport" content="width=device-width">

Thanks in advance!提前致谢!

    <!-- Try in this way it may help You --->

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
    body {
      background-color: yellow;
    }

    @media only screen and (max-width: 600px) {
      body {
        background-color: lightblue;
      }
    }
    </style>
    </head>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM