10.07.2017 Views

246996016-HTML5-Step-by-Step

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Indenting Paragraphs 127<br />

In contrast, margins add space outside the border.<br />

add ng added space s ns de<br />

Marg ns added space s outs de<br />

By default, margin and padding attributes apply to all four sides of an element, but you<br />

can add -top, -right, -bottom, or -left arguments to restrict the formatting to one or more<br />

specific sides.<br />

p style="padding-left: 10px; padding-top: 5px; padding-bottom: 5px}<br />

You can use either pixels (px) or percentage (%) as the unit of measure. For example, the<br />

following line indents the first line of a paragraph <strong>by</strong> 10 percent of its total width:<br />

<br />

To apply the same formatting using a style sheet, specify the following rule:<br />

p {text-indent: 10%}<br />

In this exercise, you will indent the first line of each paragraph in an article and add<br />

padding to the left and right sides of all paragraphs. Then you will create a CSS class that<br />

removes the first-line indent and applies that class style to some individual paragraphs.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!