Home > Web Front-end > HTML Tutorial > 使用css3制作渐变分割线_html/css_WEB-ITnose

使用css3制作渐变分割线_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 08:57:10
Original
1826 people have browsed it

原理是使用css3的渐变背景,再将高设为分割线的高度

<!DOCTYPE html><html><head><style>.title{  position:relative;  text-align:center;}.title:before, .title:after {  content: "";  width: 40%;  height: 1px;  position: absolute;  top: 50%; }.title:before {  background: -webkit-linear-gradient(right, #666 , #eee);   background: -o-linear-gradient(left, #666 , #eee);   background: -moz-linear-gradient(left,#666 , #eee);  background: linear-gradient(to left, #666 , #eee);   left: 2px;}.title:after {  background: -webkit-linear-gradient(left, #666 , #eee);   background: -o-linear-gradient(right, #666 , #eee);   background: -moz-linear-gradient(right,#666 , #eee);  background: linear-gradient(to right, #666 , #eee);   right: 2px;}</style></head><body><p class="title">这是一个标题</p></body></html>
Copy after login

效果图:


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template