【问题标题】:meta viewport width not working in html file元视口宽度在html文件中不起作用
【发布时间】:2023-03-08 21:56:01
【问题描述】:

我是 HTML 新手,现在正在尝试学习和整理。 我了解了元标记,它是数据的数据。 我了解了将设备宽度用于各种类型的设备(例如手机)的概念。

这是我写的代码

<!DOCTYPE html>
 <html>
  <head>
    <title>question</title>
    <meta name="viewport" content="width=100">
  </head>
  <body>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </body>
 </html>

我打算将我的整个 HTML content=body 设置为宽度 100 px,因为我写了 viewport width 100,但它在任何设备上都不起作用。

我认为无论我的浏览器或显示器的分辨率有多大,p 文本都会显示在 100 px 宽度内,但我看到的只是可调整大小的内容,这意味着 p 内容显示在我的浏览器的全宽。

我搜索了viewport 标签,但没有找到我正在寻找的东西,我只能假设我缺少一个 JSON 文件来使用 viewport 属性?

如果有人能帮助我理解这个问题,我会非常高兴! 提前感谢,我的知识背景只是 HTML 和一点 CSS,因为我一周前开始学习这些。

【问题讨论】:

    标签: html viewport meta


    【解决方案1】:

    从 MDN Docs 你可以看到它说什么:

    对于设置初始或最大比例的页面,这意味着宽度 属性实际上转化为最小视口宽度。

    请参考以下链接了解更多信息:)

    Viewport-And-Widths from MDN

    【讨论】:

    • 您好,感谢您提供的链接,我不明白他们在说什么。我想由于我缺乏知识,你能解释更多吗?那么这是否意味着如果我不使用初始比例属性宽度不起作用?谢谢
    猜你喜欢
    • 2016-01-24
    • 2013-02-04
    • 2019-08-11
    • 2013-11-17
    • 2012-06-27
    • 1970-01-01
    • 2014-02-22
    • 2017-10-18
    • 1970-01-01
    相关资源
    最近更新 更多