• Forum Moderator applications are now open! If you're interested in joining an active team of moderators for one of the biggest Pokémon forums on the internet, click here for info.

Aligning Text?

Status
Not open for further replies.

bgt

#PocketMonsters Staff
Joined
May 2, 2005
Messages
61
Reaction score
0
I want to align some text on the same line? seems n00bish and simple... I tried <div text-align> using two div's to align some text on the left while other on the right... the result I get is a line break with the right alignment on the lower line. I want both texts on the same line aligned right and left. an example with ubb code can be seen below.

hi​
sup​

see how the word "sup" is on the lower line... anyway to get it on the same line as "hi" in html?
 
That is fairly easy. There are 2 ways to do this using the div tag and I will explain them both clearly. The first is to use Nested Div's like this
Code:
<div align="left">Hiya<div align="right">Sup</div></div>
This will give you the desired effect and is the easier of the 2 methods to use. However, be careful about how much text you type, otherwise you might face a problem of overlapping.

The other method is to use the style attribute.
Code:
<div style="position:absolute;left:0px;top:1px">Hi</div><div style="position:absolute;left:450px;top:1px">Sup</div>
This is easy to, but might cause more problems than you can account for. Replace that top: and left: with any value you like.

Hope this helps
~ CC
 
Last edited:
It might be easier for the nested tag to be a <span> rather than a <div>, though. You can also use the style attributes "float: left;" and "float: right;" for the <span> or <div>.
 
<div align=left>Hiya<div align=right>Sup</div></div>

should be

<div align="left">Hiya<div align="right">Sup</div></div>
 
*points at Gweggy* He's turning into a code bore! Shoot him before it's too late! XD
 
At least I haven't gone for XHTML yet. XD
*doesn't like XHTML...too confuzzling* XD
 
It's pretty much the same, just everything's lowercase and you have to close tags.
 
And you can't use <font>, or <u>, or any of those other tags we've all come to know and love... <_<
 
Not in any XHTML from 1.0 Strict on...it's not valid XHTML 1.1...
 
I am a stickler for valid coding too. Just that I forgot it that time as I was in a hurry. I am trying to make my site Valid XHTML next. Paul, <font>, <u>, etc are allowed allowed in Transitional HTML.

~ CC
 
Like I said, anything from 1.0 Strict on...
Meaning that they are allowed in XHTML Transitional, but not in Strict or 1.1... x.x
 
Robo is getting weird ideas XD

Now I'm a code bore too ;-; *getting PJN XHTML validated*
 
Status
Not open for further replies.
Back
Top Bottom