【发布时间】:2018-07-29 19:31:17
【问题描述】:
您好,我有以下 HTML,在容器内我有 Header、section 和 div。 使用类 rightSideDiv 的 div 下面的当前 CSS 不会显示在 section 元素的右侧。
.container {
height: 500px;
widht: 500px;
background-color: red;
}
.headerTitle {
display: inline-block;
height: 24px;
margin: 24px 24px 0;
padding: 0;
line-height: 24px;
}
.sectionClass {
width:249px;
height:200px;
background-color: yellow;
}
.rightSideDiv {
width:249px;
height:200px;
border: 4px solid green;
}
<aside>
<div class="container">
<header class="headerTitle"> Header Title </header>
<section class="sectionClass"> . </section>
<div class="rightSideDiv"> </div>
</div>
</aside>
section 和 div 应该并排显示。我不想修改当前的 HTML 结构。我已经尝试指定 float:left 或 right 但两者似乎都不起作用。
【问题讨论】:
-
宽度上的拼写错误 - 更正后,线条的宽度会将绿色框向下推