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
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.
The HTML entity … generates the glyph called a horizontal ellipsis. This is what typographers use … to represent three dots ( when they mean something is omitted ).
::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.
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.
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With