Creation of CSS pseudo element

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Creation of CSS pseudo element

Ivan Chaer

It would be useful to have a CSS pseudo element that wrapped the referenced element.

With it, we would need less html whenever a single element needs to be wrapped.

This happens frequently when I have to deal with titles decorated with lines, like:

Title -------------


------ Title ------

So, for example, if we had a pseudo element called, say 'around', I would need a single element, like:

h1::around {
  background: url('lines.png') center center repeat-x;

h1 {
  background: white;
  padding: 0 10px;

I searched through the web, and found no smart way to do it, so I am currently placing a span inside the h1 to achieve this effect.

Many thanks,