2016-08-23 6 views
0

縦型レイアウト(モバイル)にしたいと思います。それは真ん中にあるべき主要な部分(主な内容)から成っています。この部分の上部と下部には200pxの空きスペースがページの端(200pxのように上端)まで現れるはずです。しかし、この部分ではテキストがあるはずです。移動してはいけません。3列レイアウト(縦のみ)のようにレイアウトを縦に整列する方法

この写真はそれを説明する必要があります。

enter image description here

何かが気軽に明確でない場合は!

コード:

私はそれが基本的なことだ、と私はこのようにそれを行う場合は、 "VH値"

#container { 
margin-top: 10vh; 
margin-bottom: 10vh; 
width: 100vw; 
height: 80vh; 
} 

<div id="container"></div> 

でそれを試してみました。その後、

#container { 
width: 100vw; 
height: 80vh; 
} 

#top { 
width: 100vw; 
height: 10vh; 
} 

#bottom { 
width: 100vw; 
height: 10vh; 
} 

<div id="top></div> 
<div id="container"></div> 
<div id="bottom"></div> 

それをwon'私の画面に収まるように、それはちょっと大きすぎるので、スクロールする必要があります。 あなたの誰かがこれを解決するために他のアイデアや悪夢を持っていますか?

+0

私はあなたが探している言葉は "ヘッダ" と "フッター" だと思います。あなた自身でこの問題を解決し、あなたが抱えている問題を解明するために行ったことを私たちに教えてください。これは無料のコード作成サービスではありません – Turnip

+0

これは何度も "解決されました" - 特定のエラーや問題がありますか?もしそうなら、自分の仕事と問題を示すべきです。もしそうでなければ、私はこの質問をあまりにも広範囲に扱うことをお勧めしたいと思います。 – chazsolo

+0

問題ではなく要求に似ていますか? –

答えて

0

* { 
 
    padding: 0; 
 
    margin: 0; 
 
} 
 
body { 
 
    min-height: 100vh; 
 
    position: relative; 
 
} 
 
header, 
 
footer { 
 
    width: 100%; 
 
    height: 100px; 
 
    background-color: rgba(0, 0, 0, .8); 
 
    position: fixed; 
 
    color: #fff; 
 
    font-size: 80px; 
 
    text-align:center; 
 
    z-index: 10; 
 
} 
 
header { 
 
    top: 0; 
 
} 
 
footer { 
 
    bottom: 0; 
 
} 
 
main { 
 
    min-height: 100vh; 
 
    padding: 100px 200px; 
 
    position: absolute; 
 
    top: 0; 
 
    box-sizing: border-box; 
 
}
<header>I'm a header</header> 
 
<main> 
 
    <p>I need your help ones again... So I want to have a (mobile) layout which is vertically aligned. It consists of a main part (with the main content) which should be in the middle. On the top and bottom of this part there should be like 200px of free space till the edge of the page (yeah like top: 200px). But in this parts there should be some text too & it shouldn´t move. 
 
    </p> 
 
    <br> 
 
    <p> 
 
    I need your help ones again... So I want to have a (mobile) layout which is vertically aligned. It consists of a main part (with the main content) which should be in the middle. On the top and bottom of this part there should be like 200px of free space till the edge of the page (yeah like top: 200px). But in this parts there should be some text too & it shouldn´t move. 
 
    </p> 
 
</main> 
 
<footer>I'm a footer</footer>

関連する問題