I’m trying to place a image under certain div tag , but when there’s no text , it won’t show at all , so how can i force the div show the whole size of image background ?
<html>
<head>
<title> This is an demo </title>
<style>
.board {
background: url('1.jpg') no-repeat;
float: left;
}
</style>
</head>
<body>
<div class="outer">
<div class="board">Pic</div>
<div class="board">Pic</div>
<div class="board">Pic</div>
<div class="board">Pic</div>
</div>
</body>
</html>
I tried background-size , it doesn’t work at all (cover / contain)
You have to fix the dimensions of the
<div>with respect to the size of the image. Otherwise it wont show.Something similar to this
Notes: