请检查下面的代码。

我的图像没有显示在菜单栏上。 (长时间使用css :)

HTML:

<html>
    <head>
        <link href="style.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
        <div id="navigation-container">
            <div class="rectangle">
                <div class="logo"/>
            </div>
        </div>
    </body>
</html>


CSS:

#navigation-container {
    margin: 0 auto;
    width: 1050px;
}

.rectangle {
    background: black;
    position: relative;
    height: 62px;
    -moz-box-shadow: 0px 0px 4px rgba(0,0,0,0.55);
    box-shadow: 0px 0px 4px rgba(0,0,0,0.55);
    -webkit-border-radius: 3px;
    margin-top:0em;
}

.logo {
    background:url('company_logo.png');
}


提前致谢

最佳答案

您需要为.logo设置高度和宽度。 See this JSFiddle

请注意,<div>不能自动关闭,您必须具有</div><div/>是无效的HTML。

关于html - 为什么我的徽标显示在菜单栏中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10786046/

10-09 17:55
查看更多