CSS生成漂亮的水平分隔线(horizontal rule)设计效果

HTML代码中,我们常常使用HR标签来生成水平分隔线,下面分享几款不同样式的水平分隔线 

相关CSS代码

/* 渐变 color1 - color2 - color1 */

hr.style-one {

border: 0;

height: 1px;

background: #333;

background-image: linear-gradient(to right, #ccc, #333, #ccc);

}

/* 透明渐变 - color - transparent */

hr.style-two {

border: 0;

height: 1px;

background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));

}

/* 双线 */

hr.style-three {

border: 0;

border-bottom: 1px dashed #ccc;

background: #999;

}

/* 单线阴影 */

hr.style-four {

height: 12px;

border: 0;

box-shadow: inset 0 12px 12px -12px rgba(0, 0, 0, 0.5);

}

/* 云朵状 */

hr.style-five {

border: 0;

height: 0; /* Firefox... */

box-shadow: 0 0 10px 1px black;

}

hr.style-five:after {  /* Not really supposed to work, but does */

content: "\00a0";  /* Prevent margin collapse */

}

/* 内嵌 */

hr.style-six {

border: 0;

height: 0;

border-top: 1px solid rgba(0, 0, 0, 0.1);

border-bottom: 1px solid rgba(255, 255, 255, 0.3);

}

/* 晕状 */

hr.style-seven {

height: 30px;

border-style: solid;

border-color: black;

border-width: 1px 0 0 0;

border-radius: 20px;

}

hr.style-seven:before {

display: block;

content: "";

height: 30px;

margin-top: -31px;

border-style: solid;

border-color: black;

border-width: 0 0 1px 0;

border-radius: 20px;

}

/* 文字插入式 */

hr.style-eight {

padding: 0;

border: none;

border-top: medium double #333;

color: #333;

text-align: center;

}

hr.style-eight:after {

content: "gb";

display: inline-block;

position: relative;

top: -0.7em;

font-size: 1.5em;

padding: 0 0.25em;

background: white;

}

/* 分隔线统一样式 */

hr{

margin: 40px 0;

}

在线演示和调试地址

http://www.gbtags.com/gb/rtreplayerpreview/2768.htm

手机扫码阅读



最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、垂直对齐 如果你用CSS,则你会有困惑:我该怎么垂直对齐容器中的元素?现在,利用CSS3的Transform,...
    kiddings阅读 3,205评论 0 11
  • 各种纯css图标 CSS3可以实现很多漂亮的图形,我收集了32种图形,在下面列出。直接用CSS3画出这些图形,要比...
    剑残阅读 9,700评论 0 8
  • 1. tab列表折叠效果 html: 能源系统事业部 岗位名称: 工作地点 岗位名...
    lilyping阅读 1,899评论 0 1
  • 即时的记忆很重要,此刻回忆几天前的事,有些吃力哇。 街头艺人的手艺,挺好。 日本的酒店,正常大多是下午三点到第二天...
    senny1978阅读 243评论 0 4
  • 我有一个超人 他没有威风的披风 但却弯了挺直的背 他没有超能力 却撑起你头顶的那片天 岁月不温柔 留下了深深印记 ...
    周星星的小弟阅读 274评论 0 2