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

前端之家收集整理的这篇文章主要介绍了html – 将页面分成2个半部分(顶部和底部)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想将一个页面分成两半(不是一列),而是分成一行(顶部和底部),并给出2个颜色,一个用于顶部,一个用于底部.

解决方法

demo on dabblet.com

HTML:

  1. <div id="top">top</div>
  2. <div id="bottom">bottom</div>

CSS:

  1. #top,#bottom {
  2. position: fixed;
  3. left: 0;
  4. right: 0;
  5. height: 50%;
  6. }
  7.  
  8. #top {
  9. top: 0;
  10. background-color: orange;
  11. }
  12.  
  13. #bottom {
  14. bottom: 0;
  15. background-color: green;
  16. }

猜你在找的HTML相关文章