使用CSS动态移动div

时间:2017-07-10 14:13:09

标签: html css html5 css3

我有这个结构,我想要div" icon"在文本很长时动态移动

有什么想法吗?

谢谢。



.tit {
  display: table;
}

.icon {
  border-top: 5px solid currentcolor;
border-right: 5px solid currentcolor;
min-width: 42px;
float: left;
height: 22px;
margin-top: -23px;
margin-left: 25px;
}

<div class="tit">Titleeeeeeeeeeeeeeeee</div>
<div class="icon"></div>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:1)

包装为flexbox。

.wrapper {
  display: flex;
}

.icon {
  border-top: 5px solid currentcolor;
  border-right: 5px solid currentcolor;
  min-width: 42px;
  height: 22px;
  margin-left: -40px;
}
<div class="wrapper">
  <div class="tit">Titleeeeeeeeeeeeeeeee</div>
  <div class="icon"></div>
</div>

答案 1 :(得分:0)

div class="tit"包裹在div class="icon"

<div class="icon">
  <div class="tit">Titleeeeeeeeeee</div>
</div>

jsfiddle example