html - 让我的 DIV 对齐似乎很难

标签 html css

我有一个非常简单的代码:

<div>
  <div>
    <div>Topic</div>
    <div>Sub Topic</div>
  </div>
  <div>
    <div>test 1</div>
    <div>Test 2</div>
  </div>
</div>

但我想让“test 1”出现在主题的右边。现在它出现在下面。有没有办法用 CSS 解决?

最佳答案

<div>
  <div style="float:left;width:200px;">
    <div>Topic</div>
    <div>Sub Topic</div>
  </div>
  <div style="float:left;width:200px;">
    <div>test 1</div>
    <div>Test 2</div>
  </div>
<div style="clear:both;"></div>
</div>

关于html - 让我的 DIV 对齐似乎很难,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6112783/

相关文章:

html - 检查 div 影响它之前写的其他 div

javascript - 当在 CSS 中专门设置颜色时,Mootools 补间颜色过渡被元素子元素拒绝

css - 我有一张背景图片,即使它显示在桌面上也不会在移动设备上显示

css - 当 <figcaption> 的内容宽度超过 <img> 兄弟的宽度时,使 <figcaption> 呈现滚动条

javascript - 如何让文本显示在此 Bootstrap 轮播中的叠加层上方?

PHP 排行榜没有显示正确的方式

html - CSS Sprite 不显示其图像

jQuery 工具验证器错误消息位置

javascript - React.js block 元素的双向绑定(bind)

javascript - Google 图表获取 this.J[a].c 时出现问题未定义