Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colored Dots :before and :after h2

I'm trying to put colored dots before and after h2.

This is my CSS;

h2:after {
 width:10px;
 height:10px;
 border-radius:50%;
 background: #b83b3b;
}

h2:after {
 width:10px;
 height:10px;
 border-radius:50%;
 background: #b83b3b;
}

But no dots show up.

Any leads?

Thanks!

Jaeeun

like image 727
Jaeeun Lee Avatar asked Dec 14 '13 03:12

Jaeeun Lee


People also ask

What are before and after pseudo elements?

CSS ::before and ::after pseudo-elements allow you to insert “content” before and after any non-replaced element (e.g. they work on a <div> but not an <input> ). This effectively allows you to show something on a web page that might not be present in the HTML content.

What does three dots mean HTML?

The HTML entity &hellip; generates the glyph called a horizontal ellipsis. This is what typographers use … to represent three dots ( when they mean something is omitted ).

What does :: After mean in HTML?

::after (:after) In CSS, ::after creates a pseudo-element that is the last child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default.

What does before and after mean in CSS?

Definition and UsageThe ::before selector inserts something before the content of each selected element(s). Use the content property to specify the content to insert. Use the ::after selector to insert something after the content. Version: CSS2.


1 Answers

Specify a value for the content property, and then add display:inline-block

jsFiddle example

h2:after, h2:before {
    content:"\A";
    width:10px;
    height:10px;
    border-radius:50%;
    background: #b83b3b;
    display:inline-block;
}
like image 98
Josh Crozier Avatar answered Sep 21 '22 01:09

Josh Crozier