[英]Why is the content on this webpage on a mobile device with smaller equal 320px width not 100% wide?
我的问题是,在屏幕尺寸小于/等于 320 像素的移动设备上,内容未显示为 100% 宽,您可以在此图像中看到:
我还在这里上传了文件: http://files.ailola.com/tmp/v1/privacy.php
我已经能够弄清楚以下几点:
删除链接的样式表也不能解决问题。
我只是不知道原因。 你有想法吗? 非常感谢你的帮助。
我用以下方法解决了这个问题:
@media only screen and (max-width: 320px)
#container {
max-width: inherit;
width: 100%;
padding: 0 1em;
word-break: break-word;
}
问题在于,在内容内部,您有链接,它们就像一个完整的单词,因此容器倾向于适应最长的单词(这个问题存在于某些具有长单词或表达式的语言中)。 在这些情况下,您必须使用属性word-break
。 你可以在这里找到更多信息
编辑:
显然,不推荐使用属性word-break
的 value break-word
。 您也可以将属性overflow-wrap
与值break-word
一起使用,因为它具有类似的效果。
在第6
行的元视口标签内设置initial-scale=1
我们必须给 header、页脚和#container 提供width: 100%
。
word-break 属性指定单词在到达行尾时应该如何中断。
p {
word-break: break-word;
}
@media only screen and (max-width: 767px) {
header, footer, #container {
width: 100%;
padding: 0 25px;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.