将页面分成2个半部分(顶部和底部)

JNP*_*NPW 8 html

我想将一个页面分成两半(不是一列),而是分成一行(顶部和底部),并给出2个颜色,一个用于顶部,一个用于底部.

Vla*_*kov 13

在dabblet.com上演示

HTML:

<div id="top">top</div>
<div id="bottom">bottom</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

#top,
#bottom {
    position: fixed;
    left: 0;
    right: 0;
    height: 50%;
}

#top {
    top: 0;
    background-color: orange;
}

#bottom {
    bottom: 0;
    background-color: green;
}
Run Code Online (Sandbox Code Playgroud)