• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

Align Text And Justify It

When working with web pages I preferred <div code>
I always been wondering how does word press align and center the text
as i never search on the subject i always thought that it mught be a code.

to make this question more understandable i will explain what i meant by 'Align Text'.

everytime i make a page and add text to it i want the text to be centered and aling,
to do this i always have to do it manually, cus one thing is <center> the text and the
other thing is having the text nice and nead in tables cells or with out them.

example 1:

everytime i make a page and add text to it i want the text to be centered and aling,
to do this i always have to do it manually, cus one thing is <center> the text and the
other thing is having the text nice and nead in tables cells or with out them.

example 2:

everytime i  make a page and add text to it i want  the text to  be centered and aling,
to do this i always have to do it manually, cus one thing is <center> the text and the
other   thing is   having  the  text   nice and  nead  in  tables  cells or  with  out  them.

example 3:

     everytime i make a page and add text to it i want the text to be centered and aling,
    to do this i always have to do it manually, cus one thing is <center> the text and the
           other thing is having the text nice and nead in tables cells or with out them.


I don't know if anyone got my point, but what i need to get is like the example 2,
but i don't want to keep doing thins manually, i want to be able to do the same
like blugs, wordpress for example.

is there a code for this?

Any help will be appreciate
0
at_the_biginning
Asked:
at_the_biginning
  • 3
  • 3
2 Solutions
 
gmaddockgreeneCommented:
Hi, to justify your text as in example two you need to use in your css:

text-align: justify;

Gary
0
 
abelCommented:
I'm afraid I have some bad news for you: you can set text-align:justify and you can set text-align:center, but not both at the same time.

One solution would be to add another wrapper div around it, which you can give text-align:center. The inner div you give text-align:justify.

IIRC, justified text is poorly supported by browsers, so your solution will not look the same everywhere.
0
 
abelCommented:
Hmm, apparently most modern browsers support it quite well with the exception IE for table cells: http://www.cs.tut.fi/~jkorpela/www/justify.html
0
Independent Software Vendors: 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!

 
gmaddockgreeneCommented:
abel .. you are right I think. Support has got better.

I'm not sure though that you would want justify and centre together. One cancels the other out anyway.

I generally avoid the justification though for different reasons. It can make typography look dreadful depending on your viewport. I will only use rarely in an absolute positioned and sized div calss.

Gary :)
0
 
at_the_biginningAuthor Commented:

Hey gmad, you give me a good idea and i got it!
all i did is this:  i add <div align="justify"> next to the text i have in the page,
then fallowed by the </div> at the end, and worked perfect just what i wanted.

Thank You

and thank you too Abel for the other info, here get these points for that other info. :-)

Thank you guys
0
 
abelCommented:
Note that it is better to use <div style="text-align:justify">. It gives better cross-browser support and is easier to read (using styles) and, more importantly, you can place in your CSS once you have it correct:

....
<div class="justified">
 .....

in the CSS:

.justified {
    text-align: justify;
}
0
 
gmaddockgreeneCommented:
Glad to help. Please be sure to use <div style="text-align:justify"> for cross browser compatibility. :)
0

Featured Post

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!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now