同一行中的两个p标签 [英] Two p tag in same line

查看:180
本文介绍了同一行中的两个p标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 p 标记

<p style="margin: 0; display: inline;">content1</p>
<p style="margin: 0; display: inline;" align="right">content2</p>

输出为 content1content2 。我的期望是这样的:

The Output is content1content2. My expectation is like this:

content1                                                                content2 

任何人都可以帮忙。我想在左侧的 p 中使用一个 content1,在右侧的 p中使用 content2。

Can anyone help. I want one "content1" in the left p and "content2" in the right 'p'.

推荐答案

这应该可行:

<div style="overflow: hidden;">
    <p style="float: left;">content1</p>
    <p style="float: right;">content2</p>
</div>

如果两个段落包含较宽的内容(例如,几行文字),则需要在段落。

If the two paragraphs contain wide content (e.g. few lines of text) then you need to add width on paragraphs as well.

这篇关于同一行中的两个p标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆