Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to style in css: product...(price)?

Tags:

html

css

Hard for me to explain what I'm trying to achieve in a question. I've actually built it in a fiddle, but I know theirs got to be a smarter way of doing this: http://jsfiddle.net/4QgtM/1/



What I'm trying to achieve

Car ............................... $2000
Boat ............................. $20000
Airplane ........................ $200000



What I've got (Hack)

<ul>
<li><a href="javascript:void(0)">Car</a><i></i><span>$2000</span></li>
<li><a href="javascript:void(0)">Boat</a><i></i><span>$20000</span></li>
<li><a href="javascript:void(0)">Airplane</a><i></i><span>$200000</span></li>

Does anyone have a smart way of achieving this? thanks!

like image 904
Oneezy Avatar asked Jun 26 '13 05:06

Oneezy


1 Answers

Check this out... (inspired by this)

Fiddle

CSS:

ul.leaders {
    max-width: 40em;
    padding: 0;
    overflow-x: hidden;
    list-style: none
}
ul.leaders li:before {
    float: left;
    width: 0;
    white-space: nowrap;
    content:". . . . . . . . . . . . . . . . . . . . "". . . . . . . . . . . . . . . . . . . . "". . . . . . . . . . . . . . . . . . . . "". . . . . . . . . . . . . . . . . . . . "
}
ul.leaders span:first-child {
    padding-right: 0.33em;
    background: white
}
ul.leaders span + span {
    float: right;
    padding-left: 0.33em;
    background: white
}

HTML:

<ul class=leaders>
    <li><span><a href="javascript:void(0)">Car</a></span>
    <span>$200</span>

    <li><span><a href="javascript:void(0)">Boat</a></span>
    <span>$2000</span>

    <li><span><a href="javascript:void(0)">Airplane</a></span>
    <span>$20000</span>

    <li><span><a href="javascript:void(0)">Hover craft</a></span>
    <span>$200000</span>

    <li><span><a href="javascript:void(0)">Supersonic futuristic machine</a></span>
    <span>$2000000</span>
</ul>

"Just for the record" :
- another solution is to have a small dot in a img/png as background. (background: #FFF url(image.pn) repeat-x;
- one more solution is to have border-bottom: dotted;

like image 55
Sergio Avatar answered Oct 21 '22 05:10

Sergio