Kenny  Tan Kenny Tan - 6 months ago 9
HTML Question

How to make a responsive background in HTML?

How to make a background like this one?sample.
Here's mine.
Can somebody help me achieving a responsive background similar to this one.
Thanks!

Answer

You can use background-size: cover;.

body {
    background-image: url('http://static.vecteezy.com/system/resources/previews/000/094/491/original/polygonal-texture-background-vector.jpg');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
}

 .content{
   height: 300px;
   width: 300px;
   background-color: red;
 }
<a href="index.html"><button type='button' id='viewSubjectRating' class="button_position">Home</button></a>

<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>

Comments