Ive引用了几个不同的堆栈溢出问题,并尝试了与我的相似的解决方案,但我似乎找不到答案。为什么不加载图像?
我尝试在class标签和body标签中使用它们。 Ive尝试了向前和向后的斜杠。香港专业教育学院试图清除我的缓存。香港专业教育学院试图添加其他规则的高度宽度和包含。一切都无济于事。香港专业教育学院也尝试过本地和免费网址。
背景图片:image('../ img / eye.jpg');
背景图片:url(“ img / eye.jpg”);
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="styles\styles.css">
</head>
<body>
<div class="wrapper">
<h1>Front Page</h1>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
.wrapper {
margin: 0 auto;
width: 1000px;
}
.img-eye {
background-image: url("https://pixabay.com/photos/dog-bathing-sea-waves-portrait-4565646/");
background-size: 100%;
height: 200px;
width: 300px;
}
body {
background-image: image('../img/eye.jpg');
background-color: #000;
}
没有错误信息什么也没有。该死的东西是死锅。 js小提琴上的代码也是如此。 https://jsfiddle.net/greenthingsjump/htq4os9c/1/
最佳答案
您需要使用图片扩展名(jpg,png,svg)引用图片网址。您引用的页面带有嵌入式图像。尝试更改主体样式以包括以下网址:https://cdn.pixabay.com/photo/2019/10/21/10/04/dog-4565646_1280.jpg
如果您不知道,您也不会使用img-eye类。