문제

I'm trying to make a HTML list with arrows between them (Something like: Step 1-2-3).

Here's a wireframe of the result i'm trying to accomplish: enter image description here

I'm guessing that the icon and the content will be on a ul something like that:

<ul class="stepsCont"> 
  <li>
  <img src="icon" /> 
  <p>content</p>
  </li> 
</ul> 



.stepsCont li {display: inline; padding: 0 30px;}

But how to add the arrows ?

도움이 되었습니까?

해결책

you may insert the arrow as content image of a :before pseudoelement, starting from the second <li>, e.g.

li + li:before {
   content: url(arrow.png);
   display: inline-block;
   vertical-align: middle;
   margin: 0 30px;
}

or you could also add the arrow as a background

li + li  {
   background: url(arrow.png) center left no-repeat;
   padding-left: 50px;
}

Codepen Example: http://codepen.io/anon/pen/mjCnA

(Both the solution work even on IE8).

다른 팁

You can use after or before pseudonymes:

 .stepsCont li:after {
      content: ">";
      }

 .stepsCont li:last-child:after {
      display: none;
 }

Additional you can set here an Background image instead of >

You can do something like this using :after:

JSFiddle

.stepsCont li {display: inline; padding: 0 30px;} 

/*Added code*/

li:after{
    content:" >";
}

li:last-of-type:after{
    content:"";
}

Then just style the :after.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top