Solved

Aligning text..

Posted on 2000-02-29
28
203 Views
Last Modified: 2013-12-25
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
Comment
Question by:quickbasic
  • 10
  • 9
  • 4
  • +2
28 Comments
 
LVL 10

Expert Comment

by:MasseyM
ID: 2570977
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
 
LVL 1

Expert Comment

by:zxr250
ID: 2571363
<P align="justify">
this text will be justified. (Aligned left and right)
</P>
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 2571479
Try that in Netscape :)

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

0
 
LVL 1

Expert Comment

by:zxr250
ID: 2571627
Woops....never tried it in Netscape. I'll take your word that there will be problems.

<Answer withdrawn>
0
 
LVL 1

Expert Comment

by:zxr250
ID: 2571636
oh yeah....it DOES work in IE 4.
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 2571907
It doesn't work in IE 5
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2574752
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
 

Author Comment

by:quickbasic
ID: 2578437
Adjusted points to 60
0
 

Author Comment

by:quickbasic
ID: 2578438
I thought this would be an easy question. I've added 10 extra points as a bonus to who solves my problem.
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2578722
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
 

Author Comment

by:quickbasic
ID: 2581650
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
 
LVL 18

Expert Comment

by:mgfranz
ID: 2581716
???  What is a 'fill out'?  Are you talking about a form page?
0
 

Author Comment

by:quickbasic
ID: 2582042
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
 
LVL 18

Expert Comment

by:mgfranz
ID: 2582162
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:quickbasic
ID: 2620660
Ok, It seems this problem can't be solved I'm going to delete it.
0
 

Author Comment

by:quickbasic
ID: 2620665
see the text above...
0
 

Author Comment

by:quickbasic
ID: 2620666
This question has a deletion request Pending
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2620733
This question no longer is pending deletion
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2620734
Seems that by providing an answer, we have given you a solution.  Granted bad news is bad news, but it is an answer.
0
 
LVL 1

Expert Comment

by:damianosky
ID: 2627895
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
 
LVL 18

Expert Comment

by:mgfranz
ID: 2628802
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
 
LVL 1

Expert Comment

by:damianosky
ID: 2633026
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
 
LVL 18

Expert Comment

by:mgfranz
ID: 2633980
"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
 
LVL 1

Expert Comment

by:zxr250
ID: 2634541
<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
 
LVL 18

Expert Comment

by:mgfranz
ID: 2637100
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
 

Author Comment

by:quickbasic
ID: 2661809
Sorry, but it's not the answer I'm looking for. And not all browsers can show it with your answer.
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 60 total points
ID: 2662024
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
 

Author Comment

by:quickbasic
ID: 2678844
Ok, It isn't possible...I agree
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now