我有一个pspan标记,我想将它们放在一行中,有人可以帮助我该怎么做吗?

这是我的标签的外观:



#h3 {
  padding: 0;
  margin: 0;
  width: 268px;
  margin-left: 116px;
  font-size: 18px;
  color: #369;
  font-weight: bold;
}

#heart {
  color: grey;
  font-size: 15px;
  margin-left: 210px;
}

.close {
  font-size: 18px;
  margin-left: 26px;
  padding: 0px;
}

<p id="h3">
  thiss is me
</p>
<span><i class="fa fa-heart" id="heart"></i><span class="close">x</span></span>
<!--i have a heart icon -->





我想将所有这些都设置在一行中,但是当我尝试在p标签中添加更多详细信息时,所有其他#heart.close都会下降。

任何人都可以提供帮助,以便无论这些heartclose的内容是什么,它们的位置都不会改变。

最佳答案

希望这能解决您的问题。谢谢。



#h3 {
  padding: 0;
  margin: 0;
  width: 268px;
  margin-left: 116px;
  font-size: 18px;
  color: #369;
  font-weight: bold;
 display: flex;
flex-direction: row;

}

#heart {
  color: grey;
  font-size: 15px;


}

.close {
  font-size: 18px;

  padding: 10px;
}

<p id="h3">
  this is me .Check this out .What I have done.This answer solved my problem <span><i class="fa fa-heart" id="heart"></i><span class="close">x</span>
</p>

<!--i have a heart icon -->

08-17 12:15
查看更多