将图像添加到css面包屑中

时间:2015-01-15 22:40:14

标签: javascript html css breadcrumbs

我想使用这些漂亮的面包屑jsfiddle.net/orihadar/bugvgbf5/,但我需要在每个文字上方添加图片,因此每个 LI 都会包含此图片下的图片和文字(均为水平居中) 。 任何这样做的企图都会破坏这些面包屑的漂亮外观。 不知道怎么办呢?

以下是CSS:

ul{
  margin: 0;
  padding: 0;
  list-style: none;
}
#breadcrumbs-two{
  overflow: hidden;
  width: 100%;
}

#breadcrumbs-two li{
  float: left;
  margin: 0 .5em 0 1em;
}

#breadcrumbs-two a{
  background: #ddd;
  padding: .5em 1em;
  float: left;
  text-decoration: none;
  color: #444;
  text-shadow: 0 1px 0 rgba(255,255,255,.5); 
  position: relative;
}

#breadcrumbs-two a:hover{
  background: #99db76;
}

#breadcrumbs-two a::before{
  content: "";
  position: absolute;
  top: 50%; 
  margin-top: -1.5em;   
  border-width: 1.5em 0 1.5em 1em;
  border-style: solid;
  border-color: #ddd #ddd #ddd transparent;
  left: -1em;
}

#breadcrumbs-two a:hover::before{
  border-color: #99db76 #99db76 #99db76 transparent;
}

#breadcrumbs-two a::after{
  content: "";
  position: absolute;
  top: 50%; 
  margin-top: -1.5em;   
  border-top: 1.5em solid transparent;
  border-bottom: 1.5em solid transparent;
  border-left: 1em solid #ddd;
  right: -1em;
}

#breadcrumbs-two a:hover::after{
  border-left-color: #99db76;
}

#breadcrumbs-two .current,
#breadcrumbs-two .current:hover{
  font-weight: bold;
  background: none;
}

#breadcrumbs-two .current::after,
#breadcrumbs-two .current::before{
  content: normal;
}

1 个答案:

答案 0 :(得分:0)

这样的东西?

你需要更清楚你要在这里实现的目标。

http://jsfiddle.net/bugvgbf5/4/

<ul id="breadcrumbs-two">


<li>
    <a>
    <img src="https://www.gravatar.com/avatar/0dadd597898bbd33e37fe684fa07aa2d?s=24&d=identicon&r=PG"/>

        <br/>
    bkbgbhighb
    </a>
</li>