h5 元素简单自适应布局

2019-06-06  本文已影响0人  放下手机出来嗨
 <!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            *{
                margin: 0;
                padding: 0;
                box-sizing: border-box;
                text-align: center;
            }
            html,body{
                height: 100%;
            }
            header{
                width: 100%;
                height: 150px;
                line-height: 150px;
                text-align: center;
                background-color: #00BFFF;
            }
            article{
                width: 80%;
                height: 100%;
                border: 1px solid blue;
                float: left;
            }
            aside{
                width: 20%;
                height: 100%;
                float: left;
                border: 1px solid yellow;
            }
            footer{
                height: 120px;
                border: 1px solid deepskyblue;
                clear: both;
            }
        </style>
    </head>
    <body>
        <header>
            头部
        </header>
        <article>
            <section>
                文章正文            
            </section>
        </article>
        <aside>
            右侧
        </aside>
        <footer>
            页脚
        </footer>
    </body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读