[英]HTML5 Have left aligned text and right aligned text in same line within paragraph
I want to have "This is a test" left aligned and "[Rare photograph]" right aligned but still be on the same line. 我想使“这是一个测试”左对齐,而使“ [稀有照片]”右对齐,但仍然在同一行。
I'm a newbie at HTML5, so a simple explanation would be appreciated. 我是HTML5的新手,因此请您提供简单的说明。
Thanks! 谢谢! :)
:)
<p style = "margin-left:75px;max-width:750px;"><br/>
This is a test.
[Rare photograph]
</p>
You can't do that without an additional tag, but what you can do is inject a <span>
tag within a <p>
tag, and give each <span>
a respective float: left
and float: right
: 没有附加标签,您将无法做到这一点,但是您可以做的是在
<p>
标签中注入一个<span>
<p>
标签,并为每个<span>
分别指定一个float: left
和float: right
:
<p style="margin-left: 75px; max-width: 750px;"> <span style="float: left">This is a test.</span> <span style="float: right">[Rare photograph]</span> </p>
Hope this helps! 希望这可以帮助! :)
:)
One way of doign that would be having two <p>
tags: 一种统治方式是拥有两个
<p>
标签:
#left { float: left; } #right { float: right; }
<p id="left">This is a test.</p> <p id="right">[Rare photograph]</p>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.