Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

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

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.

More CSS Quick Reference:
• Set the Font Size
• Set the border-collapse
• How to Use a CSS ID Selector
• Set the Font Variant
• Set the Border Properties
• Set the Font Properties
• Set the Text Alignment
• Descendant Selector
• Specifying Color
• Use an External Style Sheet

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro



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