Jump to content

alignment

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I really feel like a big n00b asking a question here...

But, without using tables is there a way you can align something to the left, center, and right (on the same line)? Basically I want to do this, without using tables do this:
<table width="100%" border="0">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>

I know I can easily go like this:
<div align="left">1</div>
to align the text to the left. However if i go
<div align="left">1</div>
<div align="center">2</div>
<div align="right">3</div>
It will be out puted like so:
1
                 2
                                  3
On different lines, and i cant have that :mad:
Something like this sort of works, but I sense there is a better solution
<div>
<span style="left: 0px; top: 0px; position: relative; z-index: 0;">1</span>
<span style="left: 50%; top: 0px; position: relative; z-index: 0;">2</span>
<span style="left: 90%; top: 0px; position: relative; z-index: 0;">3</span>
</div>
because depending how many characters "2" and "3" get depends if they are really aligned where they are suppose to be, so although its a solution, its not the answer im looking for. :eek:

#2
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
Thats some other way, but left: 90%; thing must be changed every time you type something or edit. And will it act same in all browsers ?

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
This forum uses that technique on the forum home for the right hand column. Here is the code:

div#wrapleft {
background: url(http://forum.codecal...sc/bkg_left.gif) repeat-y top left;
}

div#wrapright {
background: url(http://forum.codecal...c/bkg_right.gif) repeat-y top right;

}

View the source for more info about it.
</span>

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I ended up doing it like this

<style>

#container{width: 90%;}

#leftnav{float: left; width: 0px; margin: 0;}

#rightnav{ float: right; width: 0px; margin: 0;}

#content{margin-left: 0; border-left: 0px; margin-right: 0px; border-right: 0px;}

</style>


<div id="container">

<div id="leftnav">aaaaaaaa</div>

<div id="rightnav">cccccccc</div>

<div id="content"><div align="center">bbbbbbbbb</div></div>

</div>


#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Why don't you want to use tables? I think it's simpler

#6
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
Tables are really simple and Thank you for giving the Idea and I will try many of these and choose whats best for me. And everybody's needs are different, so, you may not like what I use ect. lol