HTML Coding to Change the Width of a Paragraph

Techwalla may earn compensation through affiliate links in this story.
You can apply the CSS width property to paragraphs and other style elements.
Image Credit: ahunjet/iStock/Getty Images

When you use the Paragraph tag in HTML, specify the width of the paragraph in absolute or percentage terms using a cascading style sheet element, and then apply the element to one or more paragraphs on the Web page. For example, add the following between the

tags in your HTML document: and add the following between the tags:

This is a narrow paragraph

This paragraph extends up to 700px wide



To apply a single width to all paragraphs, use:

Video of the Day

Expressing Width as a Percentage

When you specify width as a percentage, the percentage applies to the width of the parent object. For example, consider the following:

This is narrow text



tag sets the width to be 700px and the

tag sets the width to be 30 percent. However, the 30 percent applies to the 700px, not to the entire width of the document, resulting in an absolute width of 700px times 0.3, or 210px.