Hi everyone,

I just had a quick question.

I have a div that has text in it.

What I want to have is some text in the left and some text in the right so inside the div, the text Hello is displayed on the left as soon as the div starts and then I want the text after that, which "HELLO", to be displayed at the right of the div near the right end.

I tried text-align:right but it didn't work.

Please help me.

I think this is an easy problem but I am not able to solve it.

Recommended Answers

All 5 Replies

Split your text - put the left-aligned stuff into a left-aligned paragraph (or float it left) and the other stuff in a right-aligned paragraph (or float it right). If you need it in columns - then use two divs inside the main one - float one left and the other right (make sure their widths add up properly) and clear the floats afterward.

ok i did float and it is working, thanks Dandello

Glad to help. :)

you can use
<span style=text-align:right>World </span>

The HTML span tag is used for grouping and applying styles to inline elements. While you could use span for alignment, alignment properties make more sense on the block level, as in div's and p's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.