html - 如何将 p 标签和 span 标签放在一行中

标签 html css

我有一个 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都保持在顶 Angular ,它们的位置不会改变。

最佳答案

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

#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 -->

关于html - 如何将 p 标签和 span 标签放在一行中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49719146/

相关文章:

css - CSS 中的线性渐变不会垂直重复

javascript - 部分回发后脚本无法正常工作

javascript - 如何使用 css 伪元素作为 jquery UI 句柄?

java - 试图从当前元素中找到下一个 div 元素

javascript - 当前元素聚焦在 Owl Carousel 中时如何显示标题 div?

css - 在不影响布局的情况下将 div 定位在 div 中

html - btns(作为 anchor 标签)不在同一高度但并排

html - 当我悬停它时出现的侧边栏

html - Bootstrap 图像缩略图容器没有间隙

html - Air: 安装时写入应用程序存储目录?