文字经过浮动div且具有负边距

时间:2019-06-05 15:28:21

标签: css

如果遇到带有负边距的浮动div,文本是否可能停止或移至新行?是否未指定div的宽度或不使用省略号?

print(Counter(divisors).most_common(1)[0][0])
.floatedconteiner {
float: right;
padding: 20px;
border: 1px solid #333;
margin-top: -80px;
}

2 个答案:

答案 0 :(得分:0)

此处不应出现负边距。元素的顺序也很重要。

.floatedconteiner {
float: right;
padding: 20px;
border: 1px solid #333;
}
<div id ="container">
  <div class="floatedconteiner">
    My floated container<br>
    <span class="myspan">2019</span>
  </div>
  <a href="https://www.hoohle.com">
    <h2>This text goes over a floated div - This text goes over a floated div - This text goes over a floated div</h2>
  </a>
</div>

答案 1 :(得分:0)

为标题提供一个等于或大于浮动元素宽度的右边距:

foo is up, uptime is: 12.22:48:26
.floatedconteiner {
  float: right;
  padding: 20px;
  border: 1px solid #333;
  margin-top: -80px;
}

h2 {
  margin-right: 200px;
}