Log In · Register

 
Text Alignment
imasharkbear
post Feb 28 2009, 01:10 AM
Post #1


Member
**

Group: Member
Posts: 10
Joined: Feb 2008
Member No: 624,564



Text Alignment is pretty simple. But two separate text alignments for one line? I'm stumped.

Lets say I have a DIV content box.
I write something. I make it left aligned. Then I want a space between the text and other text that i want right aligned.
Hmm, like this:

[Favorite Color:_______________________________________Green]
For the sake of confusion, the brackets are the DIV Border.
And the underscores are the "space" between.


I tried a P alignment. But that dropped the text down a line.
and i spent about 10 minutes figuring out how many nbsp i could fit in... didn't work.



Heres a pic:
http://i525.photobucket.com/albums/cc338/c...ldesign/DIV.png


its the text that is split down the middle.




Thank You.
 
 
Start new topic
Replies (1 - 7)
mipadi
post Feb 28 2009, 02:37 AM
Post #2


Senior Member
******

Group: Administrator
Posts: 2,648
Joined: Apr 2008
Member No: 639,265



You're gonna have to use 2 <div>'s, placed side-by-side, each with their own alignments.
 
newkidontheblock
post Feb 28 2009, 09:10 AM
Post #3


Offline.
*****

Group: Official Designer
Posts: 609
Joined: Mar 2007
Member No: 507,591



You can make a HTML table
CODE
<style type="text/css" >
.left {
background-color: red;
text-align: left;
width: 150px;
}

.right {
background-color: green;
text-align: right;
width: 150px;
}
</style>

<table cellpadding="5" cellspacing="0" border="0" summary="" >
<tr>
<td class="left" > Left Text </td>
<td class="right" > Right Text </td>
</tr>
<tr>
<td class="left" > Left Text </td>
<td class="right" > Right Text </td>
</tr>
</table>

Here is a preview


You can also do that using css float. Which is for more advance building. People use it sidebars and those type of things.
 
Mikeplyts
post Feb 28 2009, 11:41 AM
Post #4


Mel Blanc was allergic to carrots.
*******

Group: Official Designer
Posts: 6,371
Joined: Aug 2008
Member No: 676,291



Yeah, the css float thing is simply a property like below.

CODE
float: left;

CODE
float: right;


The only thing is that you can't use "center", just "left" or "right".
 
imasharkbear
post Feb 28 2009, 02:19 PM
Post #5


Member
**

Group: Member
Posts: 10
Joined: Feb 2008
Member No: 624,564



Ok, How would i code the float code?
 
Mikeplyts
post Feb 28 2009, 02:22 PM
Post #6


Mel Blanc was allergic to carrots.
*******

Group: Official Designer
Posts: 6,371
Joined: Aug 2008
Member No: 676,291



You could just use the table code Fawaz provided or you could try using a div tag.
 
newkidontheblock
post Feb 28 2009, 02:43 PM
Post #7


Offline.
*****

Group: Official Designer
Posts: 609
Joined: Mar 2007
Member No: 507,591



Here is how you use CSS Float
This wasn't tested.
CSS
CODE
    #container {
        width: 300px;
        overflow: hidden;
}

    #left {
        text-align: left;
        float: left;
        width: 100px;
}

    #right {
        text-align: right;
        float: right;
        width: 150px;
}


HTML
CODE
<div id="container" >
    <div id="left" >
        Left Content Goes Here
    </div>
    <div id="right" >
        Right Content Goes Here
    </div>
</div>


Thank you Mike for the post below me. I fixed it.
 
Mikeplyts
post Mar 1 2009, 10:15 AM
Post #8


Mel Blanc was allergic to carrots.
*******

Group: Official Designer
Posts: 6,371
Joined: Aug 2008
Member No: 676,291



^You acciendently put a single quote instead of a semi-colon at the end of "float: right".
 

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members: