[英]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.