我在网上搜索了我的问题的答案。当然,这让我想到了一些关于 stackoverflow 的话题。我尝试了提供的解决方案,但到目前为止我没有成功!有人可以快速浏览一下我的 html 和 css 吗?这是关于侧边栏ID。我已经将背景颜色定义为红色,所以你应该不会错过它。
<!DOCTYPE HTML>
<html lang="nl">
<head>
<meta charset="utf-8" />
<title>Eenmaal Andermaal</title>
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
table {
border-spacing:10px;
}
<!---Veiling foto's--->
.imgBig {
width: 252px;
height: 252px;
}
.imgSmall {
width: 80px;
height: 80px;
}
#enlarged {
float:left;
}
#thumbnails {
float:left;
}
<!---Bod bar--->
#sidebar {
float:left;
width:272px;
height:739px;
background-color:red;
}
<!---Links--->
a {
text-decoration:none;
color:#535f79;
}
a:hover {
text-decoration:underline;
}
</style>
</head>
<body>
<h2>Titel van deze veiling</h2>
<table>
<tr>
<td>Voorwerpnummer:</td><td>7324474820</td>
</tr>
</table>
<!--Foto's-->
<div id="enlarged">
<img class = "imgBig" src = "img\versterker.jpg" alt="">
</div>
<div id="thumbnails">
<table>
<tr>
<td>
<a href="img\versterker.jpg"><img class = "imgSmall" src = "img\versterker.jpg" alt=""></a>
</td>
<td>
<a href="img\versterker.jpg"><img class = "imgSmall" src = "img\versterker.jpg" alt=""></a>
</td>
</tr>
<tr>
<td>
<a href="img\versterker.jpg"><img class = "imgSmall" src = "img\versterker.jpg" alt=""></a>
</td>
<td>
<a href="img\versterker.jpg"><img class = "imgSmall" src = "img\versterker.jpg" alt=""></a>
</td>
</tr>
</table>
</div>
<!--Biedingen-->
<div id="sidebar">
<table>
<tr>
<td>Verkoper:</td><td>Gebruiker793</td>
</tr>
<tr>
<td>Locatie:</td><td>Arnhem</td>
</tr>
<tr>
<td>Beoordeling:</td><td></td>
</tr>
<tr>
<td><a href>Neem contact op met verkoper</a></td><td></td>
</tr>
<tr>
<td>Geplaatst:</td><td>22-11-2013 11:00</td>
</tr>
<tr>
<td>Looptijd:</td><td>7 dagen</td>
</tr>
</table>
</div>
</body>
</html>
最佳答案
CSS 无效,因为评论:<!---Veiling foto's--->
这是 HTML 注释。
[In CSS] comments begin with the characters "/" and end with the characters "/". They may occur anywhere outside other tokens, and their contents have no influence on the rendering. Comments may not be nested.
更新的 CSS
table {
border-spacing:10px;
}
/* Veiling foto's */
.imgBig {
width: 252px;
height: 252px;
}
.imgSmall {
width: 80px;
height: 80px;
}
#enlarged {
float:left;
}
#thumbnails {
float:left;
}
/* bod bar */
#sidebar {
float:left;
width:272px;
height:739px;
background-color:red;
}
/* Links */
a {
text-decoration:none;
color:#535f79;
}
a:hover {
text-decoration:underline;
}
关于css - 我的 div 中的背景颜色未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20334250/