css - <header> 中的容器元素未显示

标签 css html

我将“section”元素用作“header”元素中的容器。

容器没有以任何方式显示。

直播:http://blnr.org/testing

HTML

    <!-- start pagewrap -->
    <div id="pagewrap">

        <!-- start header -->
        <header>

            <section id="container">    

            </section>

        </header>
        <!-- end header -->

    </div>
    <!-- end pagewrap -->   

CSS

header {
    position: absolute;
    left: 0px;
    width: 100%;
    height: 65px;
    background-color: #F9F9F9;
    border-bottom: thin solid #C6D9F1;
    margin: 10px 0 10px 0;
}

header section #container {
    width: 900px;
    height: 30px;
    border: thin dotted black;
    margin: 0 auto;
}

最佳答案

你有一个小错误:

将 CSS 中的 header section #container 更改为 header section#container,如下所示:

header section#container {
    width: 900px;
    height: 30px;
    border: thin dotted black;
    margin: 0 auto;
}

您所做的基本上是在 id="container" 部分中寻找元素宽度。

关于css - &lt;header&gt; 中的容器元素未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17354334/

相关文章:

javascript - Div1 覆盖 Div2 : how to check if the mouse is over the covered Div2?

javascript - 我如何淡入和淡出 div 的颜色变化?

html - 在 wordpress 的左侧和右侧添加带有文本的页脚

c# - 如何在 C# 中将包含 HTML 的字符串呈现为图像?

css - 使用 calc 时在 IE9-11 中过渡不动画

javascript - 如何让这个JS倒计时时钟依赖DB值来倒计时?

html - 直接 child 的备用表行颜色

html - td 中的 css 3 图像

html - 我如何让这个 Bootstrap 轮播工作

javascript - 渐变按钮到背景颜色在悬停时闪烁