Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Aligning text..

Hi there,

Can anyone tell me how i can do this ? I want the text on a html page to be aligned on both the left and right side. How can i do this without using any script ? (Preferable html code)
0
quickbasic
Asked:
quickbasic
  • 10
  • 9
  • 4
  • +2
1 Solution
 
MasseyMCommented:
Do you mean that you want the text to span the entire page?

Not sure what you are asking to do...

You aren't looking for something like this are you?
<TABLE WIDTH="100%">
<TR>
<TD ALIGN="LEFT">I am Left Aligned</TD>
<TD ALIGN="RIGHT">I am Right Aligned</TD>
</TR>
</TABLE>
0
 
KennyIT Application ExecutiveCommented:
<P align="justify">
this text will be justified. (Aligned left and right)
</P>
0
 
MasseyMCommented:
Try that in Netscape :)

Heck, for matter of fact, try that in Internet Explorer :)

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
KennyIT Application ExecutiveCommented:
Woops....never tried it in Netscape. I'll take your word that there will be problems.

<Answer withdrawn>
0
 
KennyIT Application ExecutiveCommented:
oh yeah....it DOES work in IE 4.
0
 
MasseyMCommented:
It doesn't work in IE 5
0
 
mgfranzCommented:
Try this, text-align:
Value: left | right | center | justify
Initial: UA specific
Applies to: block-level elements
Inherited: yes
Percentage values: N/A

This property describes how text is aligned within the element. The actual justification algorithm used is UA and human language dependent.

Example:

DIV.center { text-align: center }
Since 'text-align' inherits, all block-level elements inside the <DIV> element with CLASS=center will be centered. Note that alignments are relative to the width of the element, not the canvas. If 'justify' is not supported, the UA will supply a replacement. Typically, this will be 'left' for western languages.

<... col...>: (IE only)
ALIGN="center|justify|left|right"
This sets the text alignment within the column group. The default value is "center"


0
 
quickbasicAuthor Commented:
Adjusted points to 60
0
 
quickbasicAuthor Commented:
I thought this would be an easy question. I've added 10 extra points as a bonus to who solves my problem.
0
 
mgfranzCommented:
Can you elaborate further?  The comments suggested so far are viable solutions, are you using columns?  Is this in a table?  Do you want a few <td> where the left <td> aligns the text left, and the right <td> aligns the text right?
0
 
quickbasicAuthor Commented:
I want the same effect in my browser on the text as in Word when you choose for 'Fill out'. Note, every browser must be able to display it, and i don't want to use any script.
0
 
mgfranzCommented:
???  What is a 'fill out'?  Are you talking about a form page?
0
 
quickbasicAuthor Commented:
ok, let me try it in words...
I've got a couple of sentences like this
This is a test, this is a test
This is a test, this is a test.

Now i wan't that text to be outputed like this:
This  is  a  test, this  is  a  test
This  is  a  test, this  is  a  test.

So that all sentences take in the same amount of space. Hope this clears up my question.
0
 
mgfranzCommented:
Can't do it without a script.  Since HTML code recognizes a space as a space only, and &nbsp; as a space, there is no way to control how much space is between words without entering a &nbsp, how are you going to handle browser size issues?

Sorry... I don't know of any way to do this.
0
 
quickbasicAuthor Commented:
Ok, It seems this problem can't be solved I'm going to delete it.
0
 
quickbasicAuthor Commented:
see the text above...
0
 
quickbasicAuthor Commented:
This question has a deletion request Pending
0
 
mgfranzCommented:
This question no longer is pending deletion
0
 
mgfranzCommented:
Seems that by providing an answer, we have given you a solution.  Granted bad news is bad news, but it is an answer.
0
 
damianoskyCommented:
The only way you can get right and left aligning is using the CSS property setted to "justify" for the paragrapgh you refer to or, more simply, use:

<P align="justify">Text to justify</p>

There is no other way to get this feature neither in Netscape nor in Explorer.

Keep in mind, moreover, that this feature is only available with 4.x versions of the browsers.

The justifying has as countepart the inserting of spaces between words (like in Microsoft Word) and this can give results very different depending on font settings on every browser (especially if words of sentences are long).

Sometimes you can have unexpected results in formatting page, again different in Netscape and Explorer.

With combining the use of tables you can format page with more control on layout, but depends on the results you want to have.

Script does not resolve problem, because the layout resides on HTML format, so HTML + CSS are the only way to control layout. Javascript or VBscript can only access page properties through their privileged ways, but cannot change the "rules of the game"

If you really need universal layout controlled, with the "same" output for every browser, the only way is use graphics. Write you text, and then with cut and paste with a good graphic program (like Paint Shop Pro or Corel Photopaint) get your text converted in GIF or JPG format.

Be careful to not exagerate with images, because they are more slow to load. But if you break up your big images with the text formatted in small one (put side by side on the page) you can get good results (see Microsoft and Borland Sites for an example).

The results depends only on your ability.


Good work!

0
 
mgfranzCommented:
damianosky, the CSS 'justify' solution has been posted here at least three times, if you had read the question and it's comments you would have known that.
0
 
damianoskyCommented:
Mr. mgfranz, it's quickbasic to decide if my answer is complete or not, NOT you. He has done an answer, i've give him my proposed COMPLETE answer, obviously covering some parts just explained (it is unavoidable).

If he doesn't like it, no problem for me. He can refuse my answer (or simply ignore it).

If YOU have some problems, avoid your awfull comments. This is not the first of yours i find here in E-E; if you are not able to give a good answer, try to not write stupids comments to the answer of others, which are here to help someone, not to win or earn anything.

If you don't agree with expert exchange rules, avoid to come here with your stupid observation.

Thanks!!
0
 
mgfranzCommented:
"awful comments"?  I stated that your proposed "answer" has been given 3 times previously.  It is avoidable.  If you have some comments that are of importance that has not already been covered then feel free to post them, it's not the rule, just the courtesy to those who have been there prior to your imitation.

If you have a SOLUTION to a posted problem, then feel free to post an answer, otherwise leave it alone.  

In other words, be part of the solution, not the problem.
0
 
KennyIT Application ExecutiveCommented:
<Damien>"If you don't agree with expert exchange rules, avoid to come here with your stupid observation."

I don't think it is against EE rules to point out someone else's MISTAKE. However, I do believe that it is VERY improper for you to post other expert's answers as your own. I guess you really want an EE t-shirt but this is not the way to get it.
0
 
mgfranzCommented:
Damien, You have only been here for a month, please be thoughful when posting comments or answers.  It is improper to use another experts comment as your answer.
0
 
quickbasicAuthor Commented:
Sorry, but it's not the answer I'm looking for. And not all browsers can show it with your answer.
0
 
mgfranzCommented:
Right, you are not going to be able to satisfy all the browsers all the time...  

In other words, you can't do it.

Mark
0
 
quickbasicAuthor Commented:
Ok, It isn't possible...I agree
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 10
  • 9
  • 4
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now