我在图片显示方面遇到了一些问题。以下是我的代码:
.night-sky {
position: relative;
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
background: -webkit-linear-gradient(top, #020107 0%, #311B46 50%, #592C67 60%, #803E7E 75%, #CA759C 90%, #EC9D9D 95%, #C35E4D 100%);
background: linear-gradient(to bottom, #020107 0%, #311B46 50%, #592C67 60%, #803E7E 75%, #CA759C 90%, #EC9D9D 95%, #C35E4D 100%);
}
.night-sky:before {
height: 100%;
width: 100%;
content: ' ';
position: absolute;
top: 0;
/* http://bg.siteorigin.com/ */
background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/424395/night-sky-texture.png");
opacity: .1;
}
body {
height: 100%;
margin: 0;
background: #000;
}
<body>
<div class="night-sky">
<p>qerqwer</p>
<p>hahahh</p>
</div>
</body>
这是现在的样子:
如果我在之间没有添加段落,则什么也不会显示。但是,如果我只是在body中添加background-image,它将正确显示。我不知道问题出在哪里。
谢谢。
谢谢。