如何在HTML中创建响应式背景?

时间:2016-06-03 13:19:27

标签: html css

如何制作这样的背景?sampleHere's mine。 有人可以帮助我实现类似于此的响应背景。 谢谢!

2 个答案:

答案 0 :(得分:0)

您可以使用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>

答案 1 :(得分:0)

W3 Schools

处获取background-size: cover;.个更多信息