HTML中关于边框(border)的使用

同时设置上下左右边框:

border: 宽度 样式 颜色; 其中颜色可以省略(默认黑色),样式不能省略分别设置上右下左边框(1)

border-top: 宽度 样式 颜色;(顶部)

border-right:宽度 样式 颜色 ;(右边)

border-bottom:宽度 样式 颜色 ;(下边)

border-left: 宽度 样式 颜色;(左边)

分别设置上右下左边框(2),如果省略左则和对边(右)格式相同,如果省略下则和对边(上)格式相同,如果省略右,下,左则和 上 格式相同,

border-width:上 右 下 左;

border-style: 上 右 下 左;

border-color: 上 右 下 左;

分别设置上右下左边框(3)

border-top-width:2px ;

border-top-style: solid;

border-bottom-color:blue ;

关于样式:solid(实线),dotted(虚线)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            .box1{
                width: 200px;
                height: 100px;
                border: 3px solid red;
            }
            .box2{
                width: 200px;
                height: 100px;
                border-top:   5px solid red;
                border-right: 5px solid red;
                border-bottom:5px solid red ;
                border-left:  5px solid red;
            }
            .box3{
                width: 200px;
                height: 100px;
                border-width: 1px 2px 3px 4px;
                border-style: solid dotted double solid;
                border-color:  antiquewhite aqua blueviolet chartreuse;
            }
        </style>
    </head>
    <body>
        <div class="box1">边框测试1</div>
        <div class="box2">边框测试2</div>
        <div class="box3">边框测试3</div>
    </body>
</html>

  • 9
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

goldm68

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值