Check out this code snippet
I'm curious why the background-image
isn't visible unless I specify the image's width and height in pixels. I attempted to set only the width as a percentage, but it didn't work. Interestingly, w3cschools.com managed to display the background image without specifying dimensions, however, it was limited to the body background only. Any insights or solutions for this issue?
HTML
<div class="pic"></div>
CSS
.pic {
background: url("http://i.imgur.com/HIt6f8r.png") no-repeat;
display: block;
position: relative;
width: 244px;
height: 230px;
background-size: contain;
}