Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the :after CSS pseudo-element without inserting content

Is it possible to use the :after CSS pseudo-element to offset alignment without actually inserting anything in content: "". It doesn't seem to render unless content is specified so just wondered whether this is possible or if there are any known workarounds.

As an example:-

.nav-primary li.level0 a:after {
    content: "";
    padding-right: 1px;
    margin-left: -1px;
}

As you can see from the example, simply changing the colour of the content would not work in this instance as would still consume space affecting the offset.

like image 316
zigojacko Avatar asked Nov 06 '14 11:11

zigojacko


1 Answers

I ran into a similar situation which was fixed by adding display: block to the :before styles.

like image 88
g-harel Avatar answered Sep 23 '22 23:09

g-harel