CSS学习(三)-css边框样式(上)

一、理论:

1.css边框简介
a.border-width 设置粗细
b.border-color 设置颜色
c.border-style 设置类型
d.以上都遵守TRBL原则,例:border-top-style
2.边框的类型
a.none 无边框
b.hidden 无边框,但对于表而言是解决边框冲突
c.dotted 点状边框
d.dashed 虚线边框
e.solid 实线边框
f.double 双线边框
g.groove 凹槽边框
h.ridge 垄状边框
i.inset 3d inset边框
j.outset 3d outset边框
k.inherit 从父元素继承边框样式,但只有某些浏览器支持此属性
3.不同浏览器前缀:
a.-moz- firefox
b.-o- Opera
c.-khtml-  Konqueror
d.-ms- Internet Explorer
e.插件-prefix-free 可略去浏览器前缀
4.border-image属性语法及参数:
a.none 无背景
b.image 背景图片
c.<number> 表示方位
d.<precentage> 设置边框背景图片大小(百分比)
e.stretch\repeat\round 拉伸\重复\平铺边框背景

二、实践:

1.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .border-image{
            background-color: #6bb2ff;
            width:150px;
            height: 100px;
            border: 27px solid;
            -webkit-border-image: url(images/border.jpg) 27 round stretch;
            -moz-border-image: url( images/border.jpg) 27 round stretch;
            -o-border-image: url( images/border.jpg) 27 round stretch;
            -ms-border-image: url( images/border.jpg) 27 round stretch;
        }
        .border-image-repeat{
            background-color: #6bb2ff;
            width:150px;
            height: 100px;
            border: 27px solid;
            -webkit-border-image: url(images/border.jpg) 27 repeat stretch;
            -moz-border-image: url( images/border.jpg) 27 repeat stretch;
            -o-border-image: url( images/border.jpg) 27 repeat stretch;
            -ms-border-image: url( images/border.jpg) 27 repeat stretch;
        }
        .border-image-stretch{
            background-color: #6bb2ff;
            width:150px;
            height: 100px;
            border: 27px solid;
            -webkit-border-image: url(images/border.jpg) 27 stretch stretch;
            -moz-border-image: url( images/border.jpg) 27 stretch stretch;
            -o-border-image: url( images/border.jpg) 27 stretch stretch;
            -ms-border-image: url( images/border.jpg) 27 stretch stretch;
        }

    </style>
</head>
<body>
    <div class="border-image"></div>
    <div class="border-image-repeat"></div>
    <div class="border-image-stretch"></div>
</body>
</html>
2.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .border-image{
            background-color: #6bb2ff;
            width:150px;
            height: 100px;
            border: 27px solid;
            -webkit-border-image: url(images/border.jpg) 27 stretch round ;
            -moz-border-image: url( images/border.jpg) 27 stretch round ;
            -o-border-image: url( images/border.jpg) 27 stretch round ;
            -ms-border-image: url( images/border.jpg) 27 stretch round ;
        }
        .border-image-repeat{
            background-color: #6bb2ff;
            width:150px;
            height: 100px;
            border: 27px solid;
            -webkit-border-image: url(images/border.jpg) 27 stretch repeat;
            -moz-border-image: url( images/border.jpg) 27 stretch repeat;
            -o-border-image: url( images/border.jpg) 27 stretch repeat;
            -ms-border-image: url( images/border.jpg) 27 stretch repeat;
        }
    </style>
</head>
<body>
    <div class="border-image"></div>
    <div class="border-image-repeat"></div>
</body>
</html>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值