Alan Alan - 2 years ago 68
HTML Question

Is there a way I can make a CSS selector put a "-" before a heading?

I have this CSS selector:

h3 {
font-size: 1rem;
}


Is there some way that I could make it change a heading:

Example


to

- Example

Answer Source

You can use the pseudo element :before to add content before it as such:

h3 {
  font-size: 1rem;
}

h3:before {
  content: '- ';
}
<h3>Example</h3>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download