CSS:两个,divs并排

Tup*_*DEV 2 html css css-float

如何使绿色/黄色框显示在侧边栏旁边而不是下方?绿色/黄色部分应为100%宽度.

Screensho

这是我的源代码: HTML

    <div id="sidebar">

    </div>

    <div class="header">

    </div>
Run Code Online (Sandbox Code Playgroud)

CSS

#sidebar{
    background-color: #404040;
    height: 100%;
    width: 50px;
}

.header{
    margin-left: 50px;
    width: 100%;
    height: 200px;
    background-color: #808000;
}
Run Code Online (Sandbox Code Playgroud)

Hii*_*ran 6

添加display:inline-block#sidebar.header