如何在CSS中向导航栏添加自定义行

时间:2015-08-06 12:16:47

标签: html css

目前正在尝试添加酷炫的设计线,如

  

http://forrester-park.co.uk/wp-content/uploads/2014/05/Fancy-line.png

到我的自定义导航栏的底部。怎么会添加这样的东西?有没有将它添加到导航栏的CSS而不是将其作为图像拉入?像http://jsfiddle.net/henry12345/6h3Lee0e/

这样的东西

主要在这里:

node.prepend_child span_node

3 个答案:

答案 0 :(得分:2)

你可以做点什么

background:url('image_url');
background-repeat: no-repeat;
background-position: bottom center;
padding-bottom: 10px;
margin:  10px 0px  10px 0px;

或使用边框图片(http://caniuse.com/#feat=border-image IE可能是一个isssue),如果你可以提供你的html / stles - 可以建议一个解决方案

答案 1 :(得分:0)

尝试使用水平规则和字体组合的组合。将中间的图标更改为您想要的任何内容。



hr {
    border: 0;
    height: 2px;
    margin:18px 0;
    position:relative;
    background: -moz-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 10%, rgba(0,0,0,0.65) 50%, rgba(0,0,0,0) 90%, rgba(0,0,0,0) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(0,0,0,0)), color-stop(10%,rgba(0,0,0,0)), color-stop(50%,rgba(0,0,0,0.65)), color-stop(90%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); /* IE10+ */
    background: linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0) 10%,rgba(0,0,0,0.65) 50%,rgba(0,0,0,0) 90%,rgba(0,0,0,0) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#00000000',GradientType=1 ); /* IE6-9 */
    margin-top: 60px;
}

hr:before {
    content: "";
    display: block;
    border-top: solid 1px #f9f9f9;
    width: 100%;
    height: 1px;
    position: relative;
    top: 50%;
    z-index: 1;
}

hr:after { 
    content: "\f1ce";
    position: absolute;
    font-family: fontAwesome;
    width: 30px;
    text-align: center;
    top: -8px;
    left: 48%;
    z-index: 99999999;
    background-color: white;
    color: #666;
    
    
}

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"/>


<hr>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

$docInput.val(null).trigger('change.select2'); with:after property

我不知道导航栏的外观,但您可以通过在菜单<div>中添加:after属性来获得所需的效果。

以下是使用您的图片的示例:

&#13;
&#13;
<div>
&#13;
.menu {
    position: relative;
}

.menu:after {
    content: url(http://forrester-park.co.uk/wp-content/uploads/2014/05/Fancy-line.png);
    display: block;
    background: white;

    position: absolute;
}
&#13;
&#13;
&#13;

jsfiddle with the same content to play around