CSS布局问题

时间:2012-12-17 22:50:53

标签: html5 css3

我想知道为什么我的Right-nav div没有响应CSS中的任何内容。

HTML:

<body>
    <div id="header">Header</div>
    <div id="main-wrap">
        <div id="sidebarwrap">
        <div id="nav">Left Nav</div>
            advertisment pictures
        </div>
    <div id="content-wrap">
        <div id="picture-wrap">
        <div class="info">Picture</div>
        </div>
            <div id = "Content"><p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p></div>
            <div class ="Right-nav"><p>right-nav</p></div>
        </div>
    </div>
    <div id="footer">Footer</div>
</body>

CSS:

/**
 * custom layout
 */

#header,
#footer {
    background-color: #f1f1f1;
    width: 60%;
    margin: 0 auto;
}

#main-wrap {
    background-color: #D9D9D9;
    width: 60%;
    margin: 0 auto;
}

#sidebar {
    background-color: #d2d2d2;
}

#content-wrap {
    background-color: #c5c5c5;
}

.info {
    background-color: #DDD;
}
.info + .info {
    background-color: #e6e6e6
}


/* sizes */
#main-wrap > div {
    min-height: 450px;
}


#header,
#footer {
    min-height: 40px;
}

.info {
    min-height: 80px;
}

/* layout */

#main-wrap {
/* overflow to handle inner floating block */
    overflow: hidden;
}

#sidebarwrap {
    float: left;
    width: 30%;
    overflow:hidden;
    background-color:blue;
}

#nav{
    min-height: 80px;
    background-color: red;
}

#content-wrap {
    float: right;
    width: 70%;
    overflow:hidden;
    background-color:blue;
}

#Content{
    float:left;
    width:40%;
    min-height:370px;
    background-color:red;
}

#Right-nav{
    background-color:red;
}

#picture-wrap {
/* overflow to handle inner floating block */
    overflow: hidden;
}

.info {
    width:100%;
    float: left;
}

2 个答案:

答案 0 :(得分:2)

这是因为您在HTML中给出了正确的div class,而在CSS中给了id,将两者都更改为一个,并且问题应该得到解决。

答案 1 :(得分:2)

<div class="Right-nav">更改为<div id="Right-nav">

相关问题