I want to put the image before span element. But image is so big. Can I change the size of image with using the ::after pseudo-element? Thanks.
            Asked
            
        
        
            Active
            
        
            Viewed 59 times
        
    0
            
            
        - 
                    1Can you please share your working code! Now, after reading your question, everything here is imaginative ! And different people can have different imaginations ! :) – Deepak Yadav Jul 20 '16 at 05:59
- 
                    section span::before { content: url("images/user.png"); } – Christina Shahoyan Jul 20 '16 at 06:05
- 
                    Possible duplicate of [Can I change the height of an image in CSS :before/:after pseudo-elements?](http://stackoverflow.com/questions/8977957/can-i-change-the-height-of-an-image-in-css-before-after-pseudo-elements) – twxia Jul 20 '16 at 06:07
- 
                    everything is ok but I want to change the size of image. – Christina Shahoyan Jul 20 '16 at 06:08
- 
                    Hey, add that code in your question itself - like go for Edit option and add there. But, now you have shared this little snippet - use `span: before {content:'';background-image: url("images/user.png") no-repeat cover;Width: something;height: something;display:block; }` – Deepak Yadav Jul 20 '16 at 06:09
- 
                    Ok. Thanks a lot ! I look at it now, it's new for me. – Christina Shahoyan Jul 20 '16 at 06:17
1 Answers
0
            This is how you can add image before <span>.
span{
  margin-left:100px;
}
span:before{
  content:'';
  width:100px;
  height:100px;
  left:5px;
  position:absolute;
  background-image : url("https://source.unsplash.com/random");
}<span> hi </span> 
    
    
        frnt
        
- 8,455
- 2
- 22
- 25
- 
                    
- 
                    Welcome @ChristinaShahoyan hope it worked for you, if so accept the answer :-) – frnt Jul 20 '16 at 06:12
- 
                    
