有没有办法使2< p>同一行中的标签
```
<p class='title'><em>WELCOME TO F-DRIVE</em></p>
<p class='b'>Free 5GB storage space!</p>```
```
这是我的代码行。我希望这两个句子都出现在同一行中。 我的CSS规则是:
```
p.b{
font-size:32px;
font-family: bangers, fantasy;
margin-left: 20px;
}
p.b2{
font-size:32px;
font-family: bangers, fantasy;
margin-right: 20px;
text-align:right;
```
第二个规则出现在第一个下方的一条线,我该如何修复?
```
<p class='title'><em>WELCOME TO F-DRIVE</em></p>
<p class='b'>Free 5GB storage space!</p>```
```
this is my line of code. I want both of these sentence to appear in the same line.
my css rules are:
```
p.b{
font-size:32px;
font-family: bangers, fantasy;
margin-left: 20px;
}
p.b2{
font-size:32px;
font-family: bangers, fantasy;
margin-right: 20px;
text-align:right;
```
the second one appears a line below the 1st, how do i fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用
span
而不是p
标签。p
是一个块元素,而span
是内联元素。您可以在此处找到有关差异的更多信息: https:// www。 sitepoint.com/community/t/p-vs-pan/5298
You can use a
span
instead of ap
tag.p
is a block element whilespan
is an inline element.You can find out more about the difference here: https://www.sitepoint.com/community/t/p-vs-span/5298
答案是
display:inline-block
,但是如果您想要这种行为,则应使用span
,因为默认情况下跨度为内联元素。它不需要任何其他样式The answer is
display: inline-block
, but if you want this kind of behaviour u should usespan
as span is inline element by default. It does not need any additional style我建议使用
&lt; span&gt;
就此而言。I would suggest using
<span>
for that matter.