css - 在并排 div 之后,我想要在左侧 Css 位置换行

标签 css

我有关于位置的 CSS 问题。在 sdie by side div 之后,我想要在左侧换行。输出如下所示。有人会告诉我如何实现它。提前致谢。

页面上的理想输出:

------------------------------------------------------------------------_------------
| left                                                                        Right |
| New line New line New line New line New line New line                             |
-------------------------------------------------------------------------------------

当前输出:

-------------------------------------------------------------------------------------
| left                                                                         Right|
|                              New line New line New line New line New line New line|
-------------------------------------------------------------------------------------

这是我的代码

<html>
<head>
<style>
h2.pos_left {
position: relative;
left: -20px;
}

h2.pos_right {
    position: relative;
    left: 20px;
}
.Right{
float: right;
text-align:right;

}

.Left{
float: left;
}

.clear{
   clear: both;
} 

.newline{
     float: left;
      text-align:left;    

}

</style>
</head>
<body>

  <div class="Left">left</div>
  <div class="Right">Right</div>
  <div class="clear"></div>
  <div class="newline">New line New line New line New line New line New line </div>


</body>
</html>

最佳答案

您的 CSS 是正确的。你的 HTML 不是。你永远不会关闭你的 Right div,所以浏览器认为你的换行符 div 在那个 div 里面。变化

<div class="Right">Right<div>

<div class="Right">Right</div>

关于css - 在并排 div 之后,我想要在左侧 Css 位置换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24808128/

相关文章:

css - 在伪元素工作之前无法获得

html - 将 div/按钮/链接修复到背景图像

html - CSS 文本和图标居中对齐问题

css - 如何创建此 css 图案背景?

html - Bootstrap 4 - 选择大于 1 px 的边框

html - Adblock Plus 阻止我网站的非广告内容

css - 在父 div 中并排子 div

css - 即使未在页面上应用 css 图像也可以加载吗?

css - 在两个div之间画一条静态线

html - CSS Filter Multiple URL - 同时获得模糊和灰度