Text justification means vertically lining up the first and/or last characters of every line in a paragraph or on a page. To set text justification, use the CSS text-align property with the value justify.
Welcome to Bucaro TecHelp!

Bucaro TecHelp
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Victims of Sandy Hook

Stop the Slaughter of Innocents. Congress is bought and paid for by gun lunatics and gun promotion groups. If you want to live in a safe America, help buy Congress back for America. Send a donation to Mayors Against Illegal Guns, 909 Third Avenue, 15th Floor New York, NY 10022

Set Text Justification

Text justification means vertically lining up the first and/or last characters of every line in a paragraph or on a page. Web browers left justify text by default, but they leave ragged edges on the right side of paragraphs.

Right text justification can make your webpage look very neat, but you don't get a free lunch. The browser lines up the ends of sentences by making some lines longer by inserting extra background pixels between some of the words. So, although the right edge of your text may look neatly lined up, the interior of your paragraph will look less neat.

To set text justification, use the CSS text-align property with the value justify. The easiest way to justify all the text on a webpage is to add the style attribute to the <body> tag as shown below.

<body style="text-align:justify;">

To set text justification for all paragraph elements on a webpage, put a style block in the <head> section of your webpage (or in a linked style sheet) with the paragraph selector as shown below.

<style type="text/css">
p
{
text-align:justify;
}
</style>

Text justification looks even neater when you also set margins. To set 20 pixel wide left and right margins with text justification use the code shown below. This code can be used with a fluid layout.

p
{
margin-left:20px;
margin-right:20px;
text-align:justify;
}

The code shown below sets fixed 400 pixel wide paragraphs with text justification.

p
{
width:400px;
text-align:justify;
}

The code shown below sets fixed 400 pixel wide paragraphs with 20 pixel wide left and right margins and text justification.

p
{
margin-left:20px;
margin-right:20px;
width:400px;
text-align:justify;
}

Web browers left justify text by default. Make your webpage look very neat by setting right text justification.

RSS Feed RSS Feed


Follow Stephen Bucaro Follow @Stephen Bucaro


Web Design Sections

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2016 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268