【问题标题】:how is this border effect achieved best with CSS?这个边框效果如何用 CSS 实现最好?
【发布时间】:2013-08-05 11:37:19
【问题描述】:

我在一个网站上看到了一个惊人的边框效果,我想知道如何最好地实现该效果。它是垂直列表中导航项之间的分隔符:

我会根据跨浏览器的兼容性来选择最佳答案(并且尽可能的简洁)。

【问题讨论】:

  • 你是想只做线条,还是想要中间的白光效果?
  • 当然是发光效果。
  • 如果你想要完全兼容的东西,你将需要使用图像......但它可以用 css 完成,现在就弄清楚......
  • 图像损坏,除了黑色方块之外什么都看不到

标签: css styles border stylesheet


【解决方案1】:

Here you go

根据您想在列表中添加的内容,您可能不得不对其进行处理!如果要更改发光颜色,只需更改渐变中的颜色即可。 This is a nice generator, which you probably already knew about.

HTML:

<ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

CSS:

ul {
    list-style: none;
    width: 200px;
}
li {
    background: rgb(30,30,30);
    text-align: center;
    height: 40px;
    color: rgb(140,140,140);
    border-bottom: 1px solid black;
}
li:after {
    content: '';
    display: block;
    position: relative;
    top: 41px;
    height: 1px;
    background: #1e1e1e; /* Old browsers */
    background: -moz-linear-gradient(left,  #1e1e1e 0%, #757575 50%, #1e1e1e 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right top, color-stop(0%,#1e1e1e), color-stop(50%,#757575), color-stop(100%,#1e1e1e)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(left,  #1e1e1e 0%,#757575 50%,#1e1e1e 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(left,  #1e1e1e 0%,#757575 50%,#1e1e1e 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(left,  #1e1e1e 0%,#757575 50%,#1e1e1e 100%); /* IE10+ */
    background: linear-gradient(to right,  #1e1e1e 0%,#757575 50%,#1e1e1e 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e1e1e', endColorstr='#1e1e1e',GradientType=1 ); /* IE6-9 */
}

【讨论】:

    猜你喜欢
    • 2016-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-12
    • 2018-02-25
    • 2019-02-13
    • 2020-02-23
    • 2020-11-23
    相关资源
    最近更新 更多