Luccas
Luccas

Reputation: 4278

Vertically center dots with CSS

How can I make dots between links vertically centered with only CSS? It's possible but I can't figure out how to do it.

Expected:

Facebook inline list: Unlike, Comment, Share, 1413, 70, 76, about a minute ago

HTML

<label><a href="#">Like</a></label>
<label><a href="#">Comment</a></label>
<label><a href="#">Share</a></label>
<label><span>1 hour ago</span></label>​

CSS

a{ 
    vertical-align: middle;
}

label:not(:last-child):after{
    content: " . ";
}

Not working example: http://jsfiddle.net/4ZFMm/

Thanks!

Upvotes: 34

Views: 33455

Answers (2)

Jonas Grumann
Jonas Grumann

Reputation: 10786

Somehow these got screwed up on the live server, although they worked locally, here's what worked for me, maybe it'll help someone else:

.element:before {
    content: "\2022";
}

Upvotes: 4

sachleen
sachleen

Reputation: 31141

Use &middot; · for a dot or &bull; for a thicker, bulleted list style dot.

For use in the content attribute, you'll need to escape it:

middot:

content: " \B7 ";

bull:

content: " \2219 ";

Refrences:

Upvotes: 71

Related Questions