Place Image Before Div Using :before
I'm trying to place an image before and after div using :before and :after. Unfortunately, I don't see images. Why? Here is the code (and in jsfiddle):
Copy
Solution 2:
You need to apply this syntax:
content: url(imageURL); with no background-image.
CSS:
#videos-part{
height: 127px;
width: 764px;
border:1px solid red;
margin:30px;
padding:30px;
}
#videos-part:before{
width: 46px;
height:46px;
content: url(http://aux.iconpedia.net/uploads/136059938344542682.png);
}
#videos-part:after{
width: 46px;
height:46px;
content: url(http://aux.iconpedia.net/uploads/136059938344542682.png);
}
Solution 3:
Add display:inline-block to #videos-part before and after selectors.
#videos-part:after, #videos-part:before {
display:inline-block;
}
Updated fiddle here.
Solution 4:
here's an updated fiddle http://jsfiddle.net/vlrprbttst/u234x/7/
1) the urls of your images are wrong (i've put a placeholder)
2) content must stay empty
3) you may need to apply relative to the parent div and absolute to the pseudo elements :before and :after and place them using top/bottomleft/right values
Post a Comment for "Place Image Before Div Using :before"