css 科技 边框_纯css制作带三角的边框(附效果图)

首先附上效果图:

以上的效果完全是用 css 来实现的,那么是怎么实现的呢?

我们知道 html 中有一些特殊的字符,具体的请点击 HTML特殊字符大全。

通过特殊字符,利用 css 中的 margin 或者 position 方法完全可以实现以上效果。

复制代码代码如下:

字符制作三角边框

*{margin:0;padding:0;}

body{font-family:SimSun;}

h1{text-align:center;}

.demo1{width:300px;margin:20px auto;border:1px solid red;height:100px;}

.demo1 em,.demo1 span{display:block;width:30px;height:16px;font-size:30px;overflow:hidden;_position:relative;margin-left:10px;}

.demo1 em{margin-top:-16px;color:red;font-style:normal;}

.demo1 span{margin-top:-14px;color:white;}

.demo2{width:300px;border:1px solid #F00;height:100px;position:relative;margin-left:auto;margin-right:auto;}

.demo2 em,.demo2 span{font-style:normal;font-size:30px;position:absolute;left:-16px;top:40px;color:red;}

.demo2 span{left:-14px;color:white;}

demo1 是用 margin 方法

demo2 是用 position 方法

PS:除了用字符可以实现三角,我们还可以利用 border 来实现三角。具体地址:https://www.jb51.net/css/33748.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值