如何使这个响应?我希望渐变和文本随着屏幕大小的变化而调整大小并保持居中。现在,渐变会不时重复,字体保持不变。我希望第一部分是 100vh,第二部分(还没有标记)不应该有渐变。
https://codepen.io/Shalise/pen/QOwbZJ
html {
height: 100%;
margin: 0;
}
h1 {
width: 100%;
top: 50%;
left: 0;
line-height: 200px;
margin-top: -100px;
position: absolute;
text-align: center;
font-family: Raleway;
color: white;
font-size: 3em;
}
body {
background: #ff7043; /* For browsers that do not support gradients */
background: -webkit-linear-gradient(left top, #ff7043, #ffc17); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(bottom right, #ff7043, #300032); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(bottom right, #ff7043, #300032); /* For Firefox 3.6 to 15 */
background: linear-gradient(to bottom right, #f79f79, #f7d08a); /* Standard syntax (must be last) */
}
<section id="gradient">
<h1>The Sun Will Come Out Tomorrow</h1>
</section>