Computer Reviewer (2nd Quarter) (Modified)
Computer Reviewer (2nd Quarter) (Modified)
HTML Paragraphs
• A paragraph always starts on a new line and is usually a block of text.
• The HTML <p> element defines a paragraph.
• A paragraph always starts on a new line, and browsers automatically add
some white space (a margin) before and after a paragraph.
Example:
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
HTML Display
• You cannot be sure how HTML will be displayed.
• Large or small screens and resized windows will create different results.
• With HTML, you cannot change the display by adding extra spaces or
extra lines in your HTML code.
• The browser will automatically remove any extra spaces and lines when
the page is displayed
HTML Horizontal Rules
• The <hr> tag defines a thematic break in an HTML page and is most
often displayed as a horizontal rule.
• The <hr> element is used to separate (or define a change) in an HTML
page:
• The <hr> tag is an empty tag, which means that it has no end tag.
HTML Line Breaks
• The HTML <br> element defines a line break.
• Use <br> if you want a line break (a new line) without starting a new
paragraph:
The HTML <pre> Element
• The HTML <pre> element defines preformatted text. The text inside a
<pre> element is displayed in a fixed-width font (usually Courier), and it
preserves both spaces and line breaks
Example (imagine there is a poem):
<!DOCTYPE html>
<html>
<body>
<pre>
This is a poem
</pre>
</body>
</html>
HTML Styles
• HTML style attribute is used to add styles to element, such as color, font,
size, and more
Background Colour
• The CSS background-colour property defines the background colour for
an HTML element
• Set the background colour for a page to powder blue:
<body style="background-color:powderblue;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
Text Colour
• The CSS colour property defines the text colour for an HTML element
<h1 style="color:blue;">This is a heading.</h1>
<p style="color:red;">This is a paragraph.</p>
Fonts
• The CSS font-family property defines the font to be used for an HTML
element:
Text Alignment
• The CSS text-align property defines the horizontal text alignment for an
HTML element:
<h1 style="text-align:center;">Centered Heading.</h1>
<p style="text-align:center;">Centered Paragraph.</p>