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 ...
随机推荐
- Window 下好用的同步备份工具(来自微软)SyncToy
SyncToy 简单好用,满足备份的基本需求.
- (并查集 贪心思想)Supermarket -- POJ --1456
链接: http://poj.org/problem?id=1456 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82830#probl ...
- C++显式转换
标准C++包含一个显式的转换语法: --static_cast:用于“良性”和“适度良性”的转换,包括不用强制转换 --const_cast:用于“const”和/或“volatile”进行转换 -- ...
- Android-AndroidStudio莫名其妙的错误-finished with non-zero exit value 1
上一篇博客,Android-AndroidStudio莫名其妙的错误-finished with non-zero exit value 1,解决了由于 string.xml 字符导致的: 而这篇博客 ...
- Win10系统下编译GEOS3.6.2
环境说明 1.Win10专业版.64位: 2.VS2012旗舰版: 3.cmake-3.9.0.64位: 资源准备 GEOS管网(http://trac.osgeo.org/geos)下载3.4.3版 ...
- oracle只导出触发器
只要触发器,其他都不要 方法1:plsql develop调用exp:tools->export object—>trigger 方法2:select dbms_metadata.get_ ...
- 在Windows 7上安装Team Foundation Server(TFS)的代理服务器(Agent)
自2009年微软发布Windows 7以来,经过8年的市场验证,Windows 7已经成为史上应用最为广泛的操作系统.但是面对技术变化的日新月异,2015年微软正式停止了对Windows 7的主流支持 ...
- Email feedback to product team about TFS and SharePoint Integration 2017.2.15
SharePoint与Team Foundation Server的集成,一直是许多研发团队所关注的问题. 通过这种集成,开发团队可以实现下面的几个功能: 1. 搭建一个与团队项目集成的门户网站,并 ...
- Hibernate与Jpa的关系
JPA全称Java Persistence API.JPA通过JDK 5.0注解或XML描述对象-关系表的映射关系,并将运行期的实体对象持久化到数据库中. JPA的总体思想和现有Hibernate.T ...
- Ajax异步请求阻塞情况的解决办法
最近使用ExtJs4的mvc模式在开发了在线漫画的后台,因为异步请求比较多,有的回应时间长,有点短.我发现在多次并发的情况下,会造成阻塞的情况.也就是说如果回应时间长的请求还在进行中,短的请求却被挂起 ...