亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

搜索
博主信息
博文 14
粉絲 0
評論 0
訪問量 13363
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板
盒子模型、元素對齊方式+絕對定位實(shí)現(xiàn)-2018年8月16日作業(yè)
悅派的博客
原創(chuàng)
992人瀏覽過

實(shí)例

    <!DOCTYPE HTML>
    <html>
    <head>
        <title>常用四種元素的對齊方式</title>
        <meta charset="UTF-8">
        <style>
            body{
                margin:0;
                padding:0;
                width:800px;
                height:600px;
            }
            div{
                margin:auto;
                padding:0;
            }
            hr,ul,span{
                margin:0;
                padding:0;
            }
            .align1{
                width:400px;
                height:150px;
                background-color: #0388f1;
                text-align:center;
                line-height:150px;
            }
            .align2{
                width:400px;
                height:150px;
                background-color: #a6f13b;
                text-align:center;
                line-height:100px;
            }
            .align21{
                width:100px;
                height:100px;
                background-color: #98cddc;
                position: absolute;
                top:175px;
                left:350px;
            }
            .align3{
                width:400px;
            }
            .align31{
                width:400px;
                height:150px;
                background-color: #b3f1c6;
                text-align:center;
                display:table-cell;
                vertical-align: middle;
            }
            .align4{
                width:400px;
                height:150px;
                background-color: #49ecf1;
                text-align: center;
                display:table-cell;
                vertical-align: middle;
            }
            .align4 li{
                font-size:30px;
                list-style: none;
                padding:5px;
                display:inline;
            }
            .align4 a{
                text-decoration:none;
            }
        </style>
    </head>
    <body><div>
        <hr>
        <div class="align1"><a href="http://ipnx.cn">PHP學(xué)習(xí)網(wǎng)</a></div>
        <hr>
        <div class="align2">
            <div class="align21">PHP學(xué)習(xí)網(wǎng)</div></div>
        <hr>
        <div class="align3">
            <div class="align31">
                <span>PHP學(xué)習(xí)網(wǎng)</span><br>
                <span>php.cn</span>
            </div>
        </div>
        <hr>
        <div class="align4">
            <ul>
                <li><a href="">1</a></li>
                <li><a href="">2</a></li>
                <li><a href="">3</a></li>
                <li><a href="">4</a></li>
                <li><a href="">5</a></li>
            </ul>
        </div>
        <hr>
    </div>
    </body>
    </html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例

實(shí)例

  <!DOCTYPE HTML>
    <html>
    <head>
        <title>絕對定位實(shí)現(xiàn)十字架</title>
        <meta charset="UTF-8">
        <style>
            body{
                margin:0;
                padding:0;
            }
            .box{
                width:300px;
                height:300px;
            }
            .box1{
                width:100px;
                height:100px;
                background-color: #0388f1;
                position:absolute;
                top:0;
                left:100px;
            }
            .box2{
                width:100px;
                height:100px;
                background-color: #51534d;
                position:absolute;
                top:100px;
                left:0px;
            }
            .box3{
                width:100px;
                height:100px;
                background-color: #3fdc4b;
                position:absolute;
                top:100px;
                left:200px;
            }
            .box4{
                width:100px;
                height:100px;
                background-color: #98cddc;
                position:absolute;
                top:200px;
                left:100px;
            }

        </style>
    </head>
    <body>
    <div class="box">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
        <div class="box4"></div>
    </div>
    </body>
    </html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例

總結(jié):

內(nèi)容區(qū)content
邊框 border
內(nèi)邊距padding
外邊距margin

邊框的兩種寫法一樣:
border-top-width:5px;
border-top-style:solid;
border-top-color:red;

border-right:10px solid green;

文檔流是元素的排列方式,總是水平排列


外邊距在垂直方向上會發(fā)生塌陷,以大數(shù)值為準(zhǔn)
多個(gè)盒子的外邊距重疊是不合計(jì)的,以大的為準(zhǔn)

批改狀態(tài):合格

老師批語:
本博文版權(quán)歸博主所有,轉(zhuǎn)載請注明地址!如有侵權(quán)、違法,請聯(lián)系admin@php.cn舉報(bào)處理!
全部評論 文明上網(wǎng)理性發(fā)言,請遵守新聞評論服務(wù)協(xié)議
0條評論
關(guān)于我們 免責(zé)申明 意見反饋 講師合作 廣告合作 最新更新
php中文網(wǎng):公益在線php培訓(xùn),幫助PHP學(xué)習(xí)者快速成長!
關(guān)注服務(wù)號 技術(shù)交流群
PHP中文網(wǎng)訂閱號
每天精選資源文章推送
PHP中文網(wǎng)APP
隨時(shí)隨地碎片化學(xué)習(xí)
PHP中文網(wǎng)抖音號
發(fā)現(xiàn)有趣的

Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號

  • 登錄PHP中文網(wǎng),和優(yōu)秀的人一起學(xué)習(xí)!
    全站2000+教程免費(fèi)學(xué)