Link to home
Start Free TrialLog in
Avatar of at_the_biginning
at_the_biginningFlag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of gmaddockgreene
gmaddockgreene
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 :)
Avatar of at_the_biginning

ASKER


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
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;
}
Glad to help. Please be sure to use <div style="text-align:justify"> for cross browser compatibility. :)