[英]CSS background-image url does not work when using brackets
Use the brackets editor. 使用括号编辑器。 here
这里
I tried to insert an image into class = portrait div by linking stylecss from index.html, but it will not insert. 我试图通过链接index.html的stylecss将图像插入到class = portrait div中,但不会插入。
Other tutorials use this. 其他教程使用此。
But why is it not working for me? 但是为什么它对我不起作用?
index.html index.html
<html>
<head>
<title> My name's lEEGANG</title>
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div clas="portrait"></div>
<div clas="profile">profile</div>
</body>
</html>
style.css style.css
body{
margin: 0;
}
body{
background-color: #111;
color: #999;
}
.portrait {
background-image: url(images/profile.png);
height: 200px;
}
Please check the class spelling in your HTML code 请检查HTML代码中的类拼写
clas="portrait" --> It should be double s "ss" clas =“ portrait”->应该是double s“ ss”
It should be:: 它应该是::
<div class="portrait"> </div>
Also include width in css if the div is empty 如果div为空,还要在CSS中包含宽度
.portrait {
background-image: url(images/profile.png);
height: 200px;
width: 200px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.