|
You use the <p> tag to create paragraphs. Each paragraph should start with a <p> tag and end with a </p> tag. Paragraphs usually appear flush left and with a ragged right hand margin and have a blank line both above and below. The browser ignores carriage returns or line breaks in HTML files; new paragraphs only start when the browser sees a <p> tag. The browser can, and does, wrap the text when it feels like it and ignores extra spaces. If you don’t put in <p> tags, the page simply becomes one single, large paragraph. Not very easy to read and it looks rather ugly too. If you want a line break, use the <br> tag inside the paragraph. The <br> tag forces a line break wherever you put it. <p>This <br>is a paragraph <br>with line breaks.</p> You can align paragraphs to the left, right or centre. For example, to right-align a paragraph, use the align attribute with the <p> tag as follows: <p align="right">This paragraph aligns to the right.</p> To centre several paragraphs, put the paragraphs inside a <center> tag: <center> <p>This paragraph is centred.</p> <p>And this paragraph is centred.</p> </center> If you want to indent a paragraph, you can use the <ul> tag to indent text from the left margin (this isn't what the tag is designed for but it works). The W3C advises that you don’t use empty paragraphs to space out the page. Microsoft® Front Page removes them and while some browsers seem quite happy to display blank paragraphs at the moment, they may not always be so obliging. If you have different types of paragraph, for example, an address, a quotation, text that looks like computer output and so on, there are a number of other tags that you can use to format these paragraphs. You can also format the text in your paragraphs, for example to make text bold or italics, and you can use a different font face, size or colour for your paragraphs. |
More information Adding headings and paragraphs Adding basic paragraphs |