Pseudo elements that are not displayed on a div. I use a sprite image, but I also tried an image without a sprite, but nothing. I tried several strategies such as absolute positioning using z-index, fields, etc. I seem to be doing it right, if I'm not mistaken, or, apparently, I'm doing something wrong. I am new to the community and searched here as well as Google, but there is no result in why it is not displayed. The code below is the simplest. Thanks to everyone who takes the time to help.
.test { display:inline-block; background:#fff; width:60%; } .test:before, .test:after { background:url("/imgs/Sprite2.png") repeat-y; } .test:before, .test:after { position:relative; display:inline-block; vertical-align:top; width:27px; height:100%; } .test:before { content:""; background-position:0 0; } .test:after { content:""; background-position:-55px 0; }
Now it works for me. The code is below. I could swear I already tried this, but I must have done something wrong the first time I did it.
.test { background:#fff; width:60%;margin:0 0 60px 5%; } .test:before, .test:after { content:""; background:url("/imgs/Sprite2.png") repeat-y; position:absolute; top:0; width:27px; height:100%; } .test:before { right:100%; background-position:0 0; } .test:after { left:100%; background-position:-55px 0; }
Tony
source share