[英]White space displaying on right side webpage on small devices like iPhone
[英]Website is displaying a white space on right side of screen in iPhone
我在http://eiglaw.com上遇到問題 - iPhone 屏幕右側顯示大約 25 像素寬的空白/邊框。 我在stackoverflow上研究了這個問題,這些帖子是相關的,但是當我嘗試提供的各種解決方案時,我無法解決這個問題:
我在 iPad 上遇到了類似的問題,但能夠通過以下媒體查詢解決它:
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
/*and (orientation : landscape)*/ {
html,
body {
width:1000px;
}
}
我嘗試了各種針對 html 和 body 元素的媒體查詢,但沒有成功。 我查看了整個 CSS 文件中的背景圖像、邊距、填充、溢出等問題,但我真的很難過。 有沒有人有任何建議?
非常感謝!
問題出在你的<h3 class="menu-toggle">Menu</h3>
(為什么是 h3,順便說一句?),它似乎比視口更寬,因為width: 100%
+ 一些填充。
嘗試設置box-sizing: border-box;
到那個元素。
這對 Tigran 很有用。
我剛剛在樣式表的頂部添加了一個全局類:
div { box-sizing: border-box; }
干杯!
使用以下樣式:
body{
overflow-x: hidden !important;
}
這將消除屏幕兩側的溢出,即屏幕上的額外空白
iOS是垃圾,找到解決為什么一半屏幕變白並且您不斷滾動進入它的唯一方法顯然是成為一個該死的程序員。
試試這個
iPhone 5 - 橫向
@media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : landscape) { }
iPhone 5 - 人像
@media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : portrait) { }
iPhone 4
@media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) { }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.