見我的例子頁面在這裏:如何讓移動設備上的縮放像PC上一樣?
http://fireman-suppression-84203.bitballoon.com
儘量放大,在這個頁面中的PC(臺式電腦),並嘗試放大(用手指)你智能手機,你可以看到區別?當文字變大時,在PC瀏覽器(例如Chrome)上進行縮放時,它會停留在屏幕的左/右限制上,但是當您試圖放大iPhone時,文本會超出左側&右邊界,你需要左右讀取所有內容。
如何使智能手機上的縮放(在我的情況下爲iPhone 7)與在PC上縮放相同?我希望唯一需要滾動的是上下滾動,我不希望頁面內容(文本,圖片......)溢出到兩邊(並且不,我不想禁用縮放選項手機)。
下面是代碼:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
div {
width:85%;
margin: auto;
border: 3px solid #73AD21;
}
</style>
</head>
<body>
<div>Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... Just an example text... </div>
<br>
</body>
</html>
我也試過這樣:
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
這:
<meta name="viewport" content="width=device-width,initial-scale=1">
但它並沒有幫助。
順便說一句 -
有時候,我看到這樣寫的 '視' 元行:
<meta ...>
,有時它是這樣寫的是:
<meta .../>
的區別是什麼這兩個之間?這兩個選項合法嗎?
謝謝!
喜@Tomas,你嘗試過「用戶可升級」設置爲yes或1這裏是鏈接[鏈接] https://css-tricks.com/snippets/html/responsive-meta-tag/ [/鏈接] – bdalina