有趣的css border 很多图形都可以做 纯html css

虽然做了一段时间前端,但自知学的都是比较基础的,要想做点有难度的还是要学习的,这不,今天就遇到了,说是得用到一个三角形,想了半天,css怎么做三角形啊。。。百度吧,大神出招,原来用的是border 原来用border 都是这么用的 border:1px solid red,哈哈 今天就给大家展示一下 border 的强大之处

1 先做一个三角形吧  

html 就是一个简单的div  

<div class="haha"></div>

主要在 css 

.haha {

    width: 0px;
    height: 0px;
    background: red;
    border-style: solid;
    border-type: solid;
    border-width: 82px;
    border-top-color: white;
    border-bottom-color: #bd4040;
    border-left-color: white;
    border-right-color: white;
}

效果

2  菱形

css

.haha{

   margin-top: 49px;
    margin-left: 100px;
    border-color: red;
    border-style: solid;
    border-width: 49px;
    width: 0px;
    height: 0px;
    -moz-transform: rotate(45deg);
    /* -webkit-transform: rotate(45deg); */
    -o-transform: rotate(45deg);
    transform: rotate(45deg);

}

 

3 扇形 

css

.haha{

    width: 0px;
    height: 0px;
    background: red;
    border-style: dashed;
    border-type: solid;
    border-width: 82px;
    border-top-color: #bd4040;
    border-bottom-color: white;
    border-radius: 102px;
    border-left-color: white;
    border-right-color: white;

}

4 彩色的圆形

.haha{

    margin-top: 100px;
    margin-bottom: 100px;
    margin-left: 100px;
    width: 0px;
    height: 0px;
    background: red;
    border-style: dashed;
    border-type: solid;
    border-width: 82px;
    border-top-color: #bd4040;
    border-bottom-color: #a9b733;
    border-radius: 102px;
    border-left-color: #1ad0ae;
    border-right-color: #e837aa;

}

5 剩下的大家就自己尝试吧 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值