モバイルサファリのバックグラウンド位置に問題があります。他のデスクトップブラウザでは正常に動作しますが、iPhoneやiPadでは動作しません。
body {
background-color: #000000;
background-image: url('images/background_top.png');
background-repeat: no-repeat;
background-position: center top;
overflow: auto;
padding: 0px;
margin: 0px;
font-family: "Arial";
}
#header {
width: 1030px;
height: 215px;
margin-left: auto;
margin-right: auto;
margin-top: 85px;
background-image: url('images/header.png');
}
#main-content {
width: 1000px;
height: auto;
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
padding-top: 15px;
padding-bottom: 15px;
background-image: url('images/content_bg.png');
background-repeat: repeat-y;
}
#footer {
width: 100%;
height: 343px;
background-image: url('images/background_bottom.png');
background-position: center;
background-repeat: no-repeat;
}
「background_top.png」と「background_bottom.png」の両方が左にずれすぎています。私はグーグルで検索しましたが、私が知る限り、バックグラウンドポジションはモバイルサファリでサポートされています。また、キーワード( "top"、 "center"など)、px、および%のすべての組み合わせを試しました。何かご意見は?
ありがとう!
更新:これが.htmlファイルのマークアップです。他のブラウザーでデザインとレイアウトが適切に表示されます:(上記のcssも更新しました)
<html lang="en">
<head>
<title>Title</title>
<link rel="Stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<div id="header"></div>
<div id="main-content"></div>
<div id="footer"></div>
</body>
</html>
両方の背景画像は非常に幅が広く(〜2000px)、任意のサイズのブラウザでスペースを占有します。
PS使用できるCSSショートカットがおそらくいくつかあることは知っていますが、今のところ、コードを表示できるように整理するのが好きです。