Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi All,

I need to align 3
tags in one line like Left, Center, Right. I used the following code but it displayed the content one by one in below.

HTML
<div id="content-left" align="left" unselectable="on">Left</div><div id="content-center" align="center" unselectable="on">Center</div><div id="content-right" align="right" unselectable="on">Right</div>


OutPut
----------------------
Left
Center
Right

So how can I view the content like in the below.

Left Center Right

Could someone help me to solve this matter?

Thanks and regards,
Chiranthaka
Posted

Yes it is possible...

Check this http://jsfiddle.net/v9djw3t3/1/[^]

Hope you are looking for this...
 
Share this answer
 
There are a few ways to do this. Your code above, without the accompanying possible existing css file displays differently as is in Chrome. One, you need to take out the inline styling (within elements) at least the "align=" stuff and use the style tag in your head section or a css file for good programming practice. However the following produces what you want initially (in Chrome using brackets editor):


div {float: left;}



You will have to play with the css if there are other things at play in your css file. Please read up on floats, flexbox etc as it will assist greatly in understanding this alignment stuff.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900