css - 我的 div 中的背景颜色未显示

标签 css html colors

我在网上搜索了我的问题的答案。当然,这让我想到了一些关于 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 注释。

CSS Syntax - 4.1.9 Comments

[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.

Working Example

更新的 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/

相关文章:

javascript - 无法读取 null 的属性 'innerHTML'

ios - CCParticleSystemQuad粒子设计器中的颜色不正确?

iphone - 如何从十六进制值转换为 UIColor?

html - 想要用图像填充缩略图容器,使用 ng-repeat Angularjs

javascript - 带开关盒的功能不提供输出

javascript - HTML Canvas 宽度

python - 让两个 Python 脚本一起工作

html - 如何在 visible-xs 和 visible-sm bootstrap 中旋转 img

html - 如何自动适应图像高度和在div中。

javascript - 我需要在 Chrome 中上传一个文件,并且需要在同一个请求中**发布**一些参数