我跟着这个教程:不能添加背景图片的CSS
https://www.youtube.com/watch?v=on7p8oqfv80
我似乎无法添加背景图像的类。这个图像链接确实有效,我已经在浏览器中打开了,我以前也使用“img src =”将它直接添加到html中。有用。
我知道样式表正在正确链接,因为文本的样式发生了变化。
我已经尝试使用单引号而不是双引号添加宽度,尝试使用背景图像而不是背景。我曾尝试使用本地映像,是的,我在Linux上,是的,我确信在该目录中的所有文件上都有chmod 777。我已经尝试了所有在这些以下链接提供了不同的解决方案:
Cannot add background image to my <div>
How to add background image in css?
Cannot add background image to my <div>
跨Linux,Windows和Mac尝试这种在Firefox,Chrome和IE。
下面是代码
var errorCallback = function(e) {
console.log('Reeeeejected!', e);
};
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia;
var video = document.querySelector('video');
if (navigator.getUserMedia) {
navigator.getUserMedia(
{
audio: true,
video: true
},
function(stream)
{
video.src = window.URL.createObjectURL(stream)
},
errorCallback);
} else {
video.src = 'somevideo.webm';
}
* {
margin: 0;
padding: 0;
border: 0;
}
h1 {
text-align: center;
font-size: 575%;
color: #4A4444;
text-transform: uppercase;
letter-spacing: 1%;
margin: 45% 0;
}
h2 {
text-align: center;
font-size: 275%;
color: #E5E5E5;
text-transform: uppercase;
letter-spacing: 1
}
}
/*---Start Parallex---*/
.parallax {
float: left;
border: 5px groove;
margin-left: 70px;
width: 100px;
height: 100px;
background-image: url('http://www.w3newbie.com/wp-content/uploads/parallax-2.jpg') repeat fixed 100%;
*/ background-size: 100% 100%;
width: auto;
}
.parallax-inner {
padding-top: 50%;
padding-bottom: 50%;
}
<h1> Space </h1>
<section class="parallex">
<div class="parallex-inner">
<h2>Space</h2>
</div>
</section>
<h1>Space</h1>
* facepalm * omg wtf ... wtf wtf ... *挂在耻辱的头* ...这么多哥们... – MedicineMan25
欢迎您:) –