css 边框颜色渐变的半圆
1.需求有这么个东西,个人不习惯背景图片来解决,开始了css尝试。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>边框渐变的拱形</title>
<style> .circle{
width: 200px;
/*height: 200px;*/
line-height: 100px;
text-align: center;
margin: 100px;
/*background-color: red;*/
}
.semi-circle {
border-radius: 200px 200px 0 0 ;
height: 100px;
border: 20px solid red;
border-bottom: 0;
/*border-image: -moz-linear-gradient(green,blue);
border-image: -webkit-linear-gradient(green,blue);
border-image: linear-gradient(to right,green,blue) 30 30;*/
} </style>
</head>
<body>
<div class="circle semi-circle"></div> </body>
</html>

2.基于上图 尝试用背景渐变来解决,so border-image上了,(不要问为啥不用border-color),但是圆角没有了,因为他们都是对border的设置。后从网上看到有伪类去做的背景渐变的按钮。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>边框渐变的拱形</title>
<style> .border{
position: relative;
border: 4px solid transparent;
border-radius: 16px;
background: linear-gradient(orange, violet);
background-clip: padding-box;
padding: 10px;
/* just to show box-shadow still works fine */
box-shadow: 0 3px 9px black, inset 0 0 9px white;
}
.border::after{
position: absolute;
top: -4px; bottom: -4px;
left: -4px; right: -4px;
background: linear-gradient(red, blue);
content: '';
z-index: -1;
border-radius: 16px;
} </style>
</head>
<body> <div class="border"></div> </body>
</html>
效果如下:

3.然后开始改造
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>边框渐变的拱形</title>
<style> .border1{
width: 200px;
height: 200px;
margin:100px auto; position: relative;
border: 1px solid transparent;
border-radius: 200px;
background: white;
background-clip: padding-box;
padding: 10px;
}
.border1::after{ position: absolute;
top: -40px;
bottom: -40px;
left: -40px;
right: -40px;
background: linear-gradient(to right,red, blue);
content: '';
z-index: -1;
border-radius: 200px;
} </style>
</head>
<body> <div class="border1"></div> </body>
</html>

4.再次改造
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>边框渐变的拱形</title>
<style> .border2{
width: 200px;
height: 100px;
margin:100px auto; position: relative;
border: 1px solid transparent;
border-bottom: 0;
border-radius: 200px 200px 0 0;
background: white;
background-clip: padding-box;
padding: 10px;
}
.border2::after{ position: absolute;
top: -40px;
bottom: 0px;
left: -40px;
right: -40px;
background: linear-gradient(to right,red, blue);
content: '';
z-index: -1;
border-radius: 200px 200px 0 0;
}
</style>
</head>
<body> <div class="border2"></div>
</body>
</html>

最终达到想要的效果。
css 边框颜色渐变的半圆的更多相关文章
- css边框颜色渐变
在实际开发中,我们经常遇见边框需要背景渐变的实现要求,那么如何去实现呢,今天给大家分享依稀几种情况 1.直角的背景渐变 <!DOCTYPE html> <html lang=&quo ...
- css3实现背景颜色渐变,文字颜色渐变,边框颜色渐变
css3的渐变可以使用2个或者多个指定的颜色之间显示平稳的过渡的效果.这篇文章主要介绍下css3实现背景颜色渐变,文字颜色渐变,边框颜色渐变的方法,以便大家学习参考! 1.css背景颜色渐变 代码: ...
- css文字颜色渐变的3种实现
在web前端开发过程中,UI设计师经常会设计一些带渐变文字的设计图,在以前我们只能用png的图片来代替文字,今天可以实现使用纯CSS实现渐变文字了.下面就介绍3中实现方式供大家参考! 基础样式: .g ...
- CSS 竖线颜色渐变
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"& ...
- css背景颜色渐变
1.效果 2.代码 /* 基本色 */ background: #3FB0AC; /* chrome 2+, safari 4+; multiple color stops */ background ...
- css颜色渐变在不同浏览器的设置
在web开发中,难免会遇到浏览器之间的兼容问题,关于Css设置颜色渐变下面有解决的办法,直接上代码: 适用于谷歌浏览器: background: -webkit-gradient(linear, 0 ...
- CSS和JS两种颜色渐变文字效果代码
js实现颜色渐变文字效果代码: <!-- js颜色渐变色文字 --> <div id="moml"> <div style="text-al ...
- 第四界css大会 黑魔法-css网格背景、颜色拾取器、遮罩、文字颜色渐变、标题溢出渐变等
1.css网格背景 <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- css盒子模型之边框宽度,边框颜色与边框样式
/* width和height只是设置盒子内容区的大小,而不是盒子的整个大小, 盒子可见框的大小由内容区,内边距和边框共同决定. */ .box1 { /* 设置内容区的宽度为400px */ wid ...
随机推荐
- (最小生成树)Agri-Net -- POJ -- 1258
链接: http://poj.org/problem?id=1258 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82831#probl ...
- Dalvik虚拟机java方法执行流程和Method结构体分析
Method结构体是啥? 在Dalvik虚拟机内部,每个Java方法都有一个对应的Method结构体,虚拟机根据此结构体获取方法的所有信息. Method结构体是怎样定义的? 此结构体在不同的andr ...
- windows下用C++获取本机IP地址
BSTR CamUtilsCtrl::GET_TERM_IP(void){ AFX_MANAGE_STATE(AfxGetStaticModuleState()); CString strResult ...
- 发个招聘贴,魔都求手游C++后端,UNITY前端,开发实习生
上海游旺网络科技有限公司成立于2015年5月,是一家极具潜力的新创移动游戏公司.公司初创团队均来自腾讯,盛大,畅游,墨麟,蜗牛等知名互联网公司,公司创始人团队参与制作过<鬼吹灯><Q ...
- Delphi XE5 图解为Android应用制作签名
http://redboy136.blog.163.com/blog/static/107188432201381872820132 Delphi XE5 图解为Android应用制作签名 2013- ...
- Postgres重置自增长id列(reset sequence)
简单的两个方法,个人比较喜欢第一个 ①ALTER SEQUENCE seq RESTART WITH 1;② SELECT setval('sequence_name', 0); 参考自http:// ...
- FreeBSD下面安装PostgreSQL。
1.确认pkg版本大于1.1.4,可以用pkg -v查看,如果小于此版本,请升级.2.在/usr/local/etc/pkg.conf文件中,删除掉repository相关的语句,像PACKAGESI ...
- 微软研发流程(ALM)管理培训会议(比亚迪汽车)
主要讨论和演示整体研发流程,包括需求管理.项目计划.开发管理.生成和发布.测试管理等. Figure 1 - 客户现场培训 Figure 2 - 客户现场培训 Figure 3 - 客户现场培训
- vs installer 将.net framework 集成到安装包中
Missing .NET Framework 4.0 in Visual Studio 2017 Prerequisites whenhttps://stackoverflow.com/questio ...
- [UWP]爱恋动漫BT开发小记
在七月和某个人相识,在七月又和这个人重回陌路,在这个伤感的七月,让我来水一篇博客. 已经很久没有写博客了,最近现在来写一篇,总结一下这个七月. 今年的暑假特别的长,大概六月中旬就考完试了,而开学一直要 ...