2017-06-02 10 views
1

クライアントのための非常に単純な「建設中」のWebサイトに問題があります。私はブートストラップを使用して応答しています。しかし、今では1024pxの幅の下で、コンテンツはそれがどのようにすべきかを中心にしていません。ここでモバイルビューのオブジェクトのセンタリングが失敗しました

私が使用していたコードです:画面は、いくつかの段階で、 "小さく" なったとき

HTML

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 
    <title>Bootstrap 101 Template</title> 

    <!-- Bootstrap --> 
    <link href="css/bootstrap.css" rel="stylesheet"> 
    <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet"> 

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
    <!--[if lt IE 9]> 
     <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> 
     <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 
    <![endif]--> 
    </head> 
    <body> 
    <div id="logo"> 

     <a href="#"> 
     <img id="logo_img" src="img/logo.png"> 
    </a> 

    </div> 
    <div id="underc"> 
    <p>Under Construction</p> 
    </div> 
    <div id="underline"> 
    </div> 
    <div id="social_media"> 

     <a href=""> 
    <img id="fb" src="img/facebook.png"> 
     </a> 
     <a href=""> 
    <img id="tw" src="img/twitter.png"> 
    </a> 
     <a href=""> 
    <img id="ig" src="img/instagram.png"> 
    </a> 

    </div> 

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
    <!-- Include all compiled plugins (below), or include individual files as needed --> 
    <script src="js/bootstrap.min.js"></script> 
    </body> 
</html> 

CSS

body { 
     margin: 0; 
     background-image: url("../img/background2.jpg"); 
     /* Set rules to fill background */ 
     min-height: 100%; 
     min-width: 1024px; 

     /* Set up proportionate scaling */ 
     width: 100%; 
     height: auto; 

     /* Set up positioning */ 
     position: fixed; 
     top: 0; 
     left: 0; 
    } 




#underline { 
    height: 5px; 
    background-color: #f57300; 
    margin-bottom: 5px; 
    margin-top: -20px; 
    width: 800px; 
    margin: 0 auto; 
} 
#logo { 
    padding-top: 220px; 
    height: 100px; 
    width: auto; 
    text-align: center; 
} 
#logo_img { 
    height: 250px; 
} 
#underc { 
    color: #f57300; 
    text-align: center; 
    padding-top: 275px; 
    font-family: 'Pacifico', cursive; 
    font-size: 80px; 
} 
#social_media { 
padding-top: 10px; 
text-align: center; 
} 
#fb { 
    height: 30px; 
} 
#tw { 
    height: 30px; 
} 
#ig { 
    height: 30px; 
} 
@media (max-width: 700px) { 
    #underline { 
    height: 5px; 
    background-color: #f57300; 
    margin-bottom: 5px; 
    margin-top: -20px; 
    width: 600px; 
    margin: 0 auto; 
} 
#logo { 
    padding-top: 220px; 
    height: 100px; 
    text-align: center; 
} 
#logo_img { 
    height: 150px; 
    text-align: center; 
} 
#underc { 
    color: #f57300; 
    text-align: center; 
    padding-top: 275px; 
    font-family: 'Pacifico', cursive; 
    font-size: 30px; 
} 
#social_media { 
padding-top: 10px; 
text-align: center; 
} 
#fb { 
    height: 30px; 
} 
#tw { 
    height: 30px; 
} 
#ig { 
    height: 30px; 

} 

} 

は、しかし、それは右に固執し始めページの横にあり、中央にはありません。

スクリーンショット:

enter image description here

答えて

0

体が最小幅特性を有し

min-width: 1024px; 

そのプロパティを消去又は異なるスクリーン上の異なるサイズを表示するmedia queriesを使用します。

+0

ああ神...ありがとう、私は本当にそれを監督しました。 –

+0

あなたが助けてくれたら、正解が役に立つと便利です.... –

+0

はい、本当にありがとうございました!私は正しい答えをurとマークしました。 –

関連する問題