css css编写三角形和半圆

本文介绍如何使用CSS代码绘制三角形和半圆形,并通过调整border属性实现不同样式的变化。

三角的四个方向可修改,根据:border-top-color:;   border-bottom-color:;  border-left-color:;  border-right-color:;

<!DOCTYPE html>
<html lang="zh">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>三角形</title>
   <style>
      .icon-b {
         display: inline-block;
         width: 0px;
         height: 0px;
         border: 10px solid transparent;
         border-top-color: #2fa0ec;
         position: relative;
         left: 3px;
         top: 2px;
      }
   </style>
</head>
<body>
   <b class="icon-b"></b>
</body>
</html>

<style>
    .semicircle {
         display: inline-block;
         width:18px;
         height:29px;
         border-radius:18px 0 0 18px;/* 左上、右上、右下、左下 */
         border:1px solid #feb34a;
         border-right: #fff;
         position: relative;
         top: 10px;
         right: -7px;
    }
</style>
<span class="semicircle"></span>

border-right设置右边线为白色;可改变为右图。


<style>
    .collection a{
        font-size: 14px;
        padding: 9px 0 9px 10px;
        color: #feb34a;
        text-decoration: none;
        border: 1px solid #feb34a;
        border-top-left-radius: 22px;
        border-bottom-left-radius: 22px;
        border-right: none;
    }
    .semic-text{
        margin-right: 20px
    }
</style>
<div class="collection">
    <a><span class="semic-text">收藏</span></a>
</div>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值