首页 > 其他 > 详细

边界线问题

时间:2017-04-27 09:53:36      阅读:208      评论:0      收藏:0      [点我收藏+]

边界线:

方法一:

  利用css3里面的属性:nth-child(),兼容高版本浏览器和ie9+

  

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            *{margin:0px;padding:0px;}
            .wrap{width:300px;height:60px;margin:100px auto;border:2px solid #ccc;}
            .wrap ul{width:100%;height:100%;overflow: hidden;}
            .wrap ul:after{display: block;content:"";clear:both;}
            .wrap ul li{list-style:none;width:99px;height:30px;line-height:30px;text-align: center;float:left;border-left:1px solid #000;}
            .wrap ul li:nth-child(3n-2){border-left:none;}
        </style>
    </head>
    <body>
        <div class="wrap">
            <ul>
                <li>111111</li>
                <li>222222</li>
                <li>333333</li>
                <li>444444</li>
                <li>555555</li>
                <li>666666</li>
            </ul>
        </div>
    </body>
</html>

技术分享

方法二:

  利用margin-left负值:

  

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            *{margin:0px;padding:0px;}
            .wrap{width:300px;height:60px;margin:100px auto;border:2px solid #ccc;}
            .wrap ul{width:100%;height:100%;overflow: hidden;}
            .wrap ul:after{display: block;content:"";clear:both;}
            .wrap ul li{list-style:none;width:99px;height:30px;line-height:30px;text-align: center;float:left;border-left:1px solid #000;margin-left:-1px;}
        </style>
    </head>
    <body>
        <div class="wrap">
            <ul>
                <li>111111</li>
                <li>222222</li>
                <li>333333</li>
                <li>444444</li>
                <li>555555</li>
                <li>666666</li>
            </ul>
        </div>
    </body>
</html>

技术分享

 两端对齐:

 

<!doctype html>
<html>
    <head>
        <title>文本两端对齐 by 司徒正美</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <style>
            .box1{
                background:red;
                width:30%;
            }
            .test1 {
                text-align:justify;
                text-justify:distribute-all-lines;/*ie6-8*/
                text-align-last:justify;/*ie9*/
                -moz-text-align-last:justify;/*ff*/
                -webkit-text-align-last:justify;/*chrome 20+*/
            }
        </style>
    </head>
    <body>
        <div class="box1">
            <div class="test1">姓 名</div>
            <div class="test1">姓 名 姓 名</div>
            <div class="test1">姓 名 名</div>
            <div class="test1">所 在 地</div>
            <div class="test1">工 作 单 位</div>
        </div>
    </body>
</html>

 

边界线问题

原文:http://www.cnblogs.com/yang0901/p/6772391.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!