I have a button that uses a graphic and has rounded corners.
In order to make the button CSS reusable, and able to accommodate any length text whilst still keeping the round corners, I’d like to use :after to add the end rounded corner after the main button (thus the first image/text can grow and the rounded corner will always be tacked on the end.)
Managed to get the :after working when I add content (e.g the words ‘test’ and some background colours) but cannot get it to work when there is no content on the styling. I just need the background image and that’s it.
JSFiddle with the buttons. You can see the :after code but for some reason this doesn’t display.
#wizard-nav .paging:after
{
background-image:url("http://i.imgur.com/GDJgl.png");
height:22px;
width:7px;
}
When using the
::beforeand::afterpseudo-selectors you need to set a value tocontent.Pseudo elements are also inline elements, so if you want to define a height or width then you must display it as a
blockelement.For example:
Working example: http://tinkerbin.com/GSO0HpD2