简体   繁体   中英

How to display 2 phrases in a single line , one center aligned ,the other right aligned in html?

I want to display the following heading line in HTML:

                         Hello World                  HTML Example

"Hello World" is center aligned while "HTML Example" is right aligned. Which HTML element should I use?

I've tried using span element and the display:inline css style but the two phrases always display in two separate lines.

HTML <h4 align="center" > Hello World <span align="right" > HTML Example </span></h4>

Hopefully it's what you're trying to achieve:

 <h4 align="center"> Hello World <span style="float:right;"> HTML Example </span></h4>

Good luck!

<h4 align="center" ><span style="float:left;margin-left:30%"> Hello World</span> <span align="right" style="float:right;margin-right:30%"> HTML Example </span></h4>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM