首页 > Web开发 > 详细

css之斜线

时间:2015-03-31 17:22:22      阅读:233      评论:0      收藏:0      [点我收藏+]
.x {
            border: solid 1px red;
            width: 100px;
            height: 100px;
            position: relative;
            background-color: transparent;
        }

            .x:before {
                position: absolute;
                top: 0px;
                right: 0;
                left: 0;
                bottom: 0;
                border-bottom: 100px solid red;
                border-left: 100px solid transparent;
                content: "";
            }

            .x:after {
                position: absolute;
                left: 1px;
                right: 0;
                top: 1px;
                bottom: 0;
                border-bottom: 99px solid white;
                border-left: 99px solid transparent;
                content: "";
            }

        .f {
            border: solid 1px red;
            width: 100px;
            height: 100px;
            position: relative;
            background-color: transparent;
        }

            .f:before {
                position: absolute;
                top: 0px;
                right: 0;
                left: 0;
                bottom: 0;
                border-bottom: 100px solid red;
                border-right: 100px solid transparent;
                content: "";
            }

            .f:after {
                position: absolute;
                left: 0;
                right: 1px;
                top: 1px;
                bottom: 0;
                border-bottom: 99px solid white;
                border-right: 99px solid transparent;
                content: "";
            }
技术分享

 

x 是 斜线, f 是反斜线。

图:

技术分享

css之斜线

原文:http://www.cnblogs.com/nc-blog/p/4381422.html

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