homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Justify Text
how to align text using external css file
Total Paranoia

 5:00 pm on Apr 10, 2003 (gmt 0)

I have a external file whereby I am controlling the font and colour etc. but I want to justify my text. I thought it would be as simple as adding text-align: justify to my file but this doesn't seem to be working.

This is the complete line of code in the file that controls the font.

.font {font-family:verdana, arial, sans-serif; text-align: justify; font-size:10pt; color:#000000; }

Justify just isn't doing what it should be doing - I have tried viewing the page in several different browsers. Where am I going wrong?

Many Thanks




 5:13 pm on Apr 10, 2003 (gmt 0)

Where do you apply the style?

I usually create two style one for the text and one to justify it.

I apply the txt style on the <TD> tag (in case you built your pages in tabe) and the justify text on the <P> tags.

If you are using Dreamweaver for example when you select all the text in a cell and apply a style it apply it to the <TD> and not the text itself. Try applying the style on the <P> tags.

Hope this help.



 5:38 pm on Apr 10, 2003 (gmt 0)

I believe that le_gber is correct, you will need to restyle a p tag to justify you text. If you don't want every single p tag to do this, apply a class to is:

p.justifiedText { text-align: justify }

Then in you html: <p class="justifiedText">

I'm not sure how well supported this is at the moment, but I'll go an do a quick test for you....

I am very pleasantly surprised, IE6, Moz1.0, Opera6, and NN4.7 all justify as requested!


 6:43 pm on Apr 10, 2003 (gmt 0)

am very pleasantly surprised, IE6, Moz1.0, Opera6, and NN4.7 all justify as requested

Yep it work great.


Total Paranoia

 1:24 pm on Apr 11, 2003 (gmt 0)

Thanks for your replies - thats great and yes it worked fine but I was hoping to able to add the justify to the existing .font style.

I have already applied the font style to all the pages and was trying to avoid having to go through my 100 or so pages to apply the <p class="justifiedText"> to my html. I have used a template in dreamweaver but I can see no way of adding the style to the template. It looks as though I would have to go through each page.


 2:36 pm on Apr 11, 2003 (gmt 0)

Depends - if you want all the text on every page justified why not redefine the <P> tag style?

The all you need to do is check that all the text was enclosed in <P>'s


Total Paranoia

 4:01 pm on Apr 11, 2003 (gmt 0)

Yup - that works - Thanks

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved