1

head、foot、textbox の 3 つの div があります。頭と足の div は固定位置で、3 番目の div は部分的に固定されています (margin-top)。

私の質問は次のとおりです。テキストボックスの div の下部を変更して、さまざまなモニターのサイズを修正するにはどうすればよいですか? 高さ 100% は foot div にぶら下がっているため使用できません。このホームページでは、背景が画像ファイルを変更しているため、スクロールバーを使用していません。どうにかして余白部分をモニターの底から離したいです。


<html>
<head>
<title>Div bottom</title>
<style>
.head{
    position:absolute;
    clear:both;
    top:0px;
    right:0px;
    float:right;
    width:100%;
    height:80px;
    background-color:grey;
}
.foot {
    position:fixed;
    clear:both;
    height:35px;
    right:0px;
    float:right;
    width:100%;
    background-color:grey;
    bottom:0px;
}
.textbox {     
    overflow: hidden;
    position: relative;
    padding:20px;
    border: 1px solid gray; 
    background-color:red;
    z-index:0;
    text-align:justify;
    color:black;
    line-height: 2em;
    border-radius: 3px;
    margin-top:100px;
    width:910px;
    margin-left: auto; 
    margin-right:auto;
}
</style>
</head>

<body>
<div class="head">HEAD</div>

<div class="textbox">?</div>

<div class="foot">FOOT</div>
</body>
</html>
4

2 に答える 2

0

そのためにスクリプトを使用する必要はありません「ヘッダー コンテンツ フッター」レイアウトの純粋な CSS ソリューションを次に示します。

セクション間のマージンはオプションであり、垂直方向と水平方向のセンタリングも同様です。そしてすべてが完全に反応します。

HTML:

<div class="Container">
    <div class="Header">
    </div>
    <div class="HeightTaker">
        <div class="Wrapper Container Inverse">
            <div>
                <div class="Footer">
                </div>
            </div>
            <div class="HeightTaker">
                <div class="Wrapper Content">
                    <div class="Centered">
                    </div>
                </div>
            </div>
        </div>
    </div>

CSS:

*
{
    margin: 0;
    padding: 0;
}
html, body, .Container
{
    height: 100%;
}
    .Container:before
    {
        content: '';
        height: 100%;
        float: left;
    }
.HeightTaker
{
    position: relative;
    z-index: 1;
}
    .HeightTaker:after
    {
        content: '';
        clear: both;
        display: block;
    }
.Wrapper
{
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: auto;
}
.Inverse, .Inverse > *
{
    -moz-transform: rotateX(180deg);
    -ms-transform: rotateX(180deg);
    -o-transform: rotate(180deg);
    -webkit-transform: rotateX(180deg);
    transform: rotateX(180deg);
}

/*For Centering only*/
    .Content:before
    {    
        content: '';
        display: inline-block;
        height: 100%;
        vertical-align: middle;
        margin-left: -5px;
    }
    .Centered
    {
        display: inline-block;
        vertical-align: middle;
    }


/*For demonstration only*/
p
{    
    font-size: 1.3em;
}

.Important
{
    font-weight: bolder;
    color: white;
}

body > .Container
{
    padding: 0 5px;
    text-align: center;
}

.Header, .Footer
{
    margin-bottom: 5px;
    padding: 5px 0;
}
.Header
{
    background-color: #bf5b5b;
}
.Content
{
    background-color: #90adc1;
}
.Footer
{
    background-color: #b5a8b7;
}
于 2013-10-03T21:19:54.387 に答える