Text and paragraph formatting tags

HTML Lesson 1.2. Text and paragraph formatting tags

Lesson objective: to learn basic tags for formatting HTML text and paragraphs.

 

Text formatting elements

Headlines

    • To place headings, there is a tag <h>with a heading level number.
<h1></h1>
  • The largest heading corresponds to the tag <h1>, and the lowest level heading (the smallest font size) corresponds to the tag <h6>.
  • The base font size on the page corresponds to the heading. <h3>:
< h1 > Heading 1 < / h1 > 
< h2 > Heading 2 < / h2 > 
< h3 > Heading 3 < / h3 > 
< h4 > Heading 4 < / h4 > 
< h5 > Heading 5 < / h5 > 
< h6 > Heading 6 < / h6 >
Heading 1

Heading 2

Heading 3

Heading 4

Heading 5

Heading 6

Block quote

<blockquote></blockquote>

To place a quote in the text, use the tag <blockquote>:

7878

Preformatted text

<pre></pre>

To preserve all whitespace characters in the text, you must use the <a href=”http://www.css.org/”>tag <pre>. However, please note that you cannot set a font style for the contents of this tag:

< pre >
Here I come,
	overseas ostrich,
		in the feathers of stanzas,
			sizes and rhymes.
Hide your head,
	silly,
		trying,
			a burst into the ringing plumage.
Here I come,
	overseas ostrich,
		in the feathers of stanzas,
			sizes and rhymes.
Hide your head,
	silly,
		trying,
			a burst into the ringing plumage.

Italic, bold, underline, and other tags

jt787896

Horizontal line

<hr>

This element serves to separate certain structural elements of the text from each other. It can also be used simply as an aesthetic element in the document’s design:

< h3 > Horizontal line < / h3 > 
< hr > 
< p > Lorem ipsum dolor sit amet. < / p >

Horizontal line


Lorem ipsum dolor sit amet.

Tag attributes

  • To clarify the action of some tags, they are supplemented with attributes.
  • So, the horizontal line tag under consideration has additional properties expressed in attributes
    • size — line width,
    • width — line length,
    • align — line alignment

    and others.

56u

  • Attributes are specified in the opening tag in the form attribute=value.
  • There may be several attributes, in which case they are specified separated by spaces, and their order is practically unimportant.

tag attributes

Body tag attributes

Let’s start by looking at the two main attributes of the tag. body:

  • bgcolor — page background and
  • text — the color of the text on the entire page.

To specify a color, you can use the color names in English or the color code in hexadecimal notation.

< body  text = "#00ff00" >

or

< body  text = "green" >

65ye
Before specifying a color in the 16-point system, the “sharp” symbol must be included. #
To select a suitable color, go to the online color palette page.

Logical text formatting tags

HTML contains tags that serve a logical or semantic purpose rather than an aesthetic purpose. This means that most of them visually affect the content, highlighting it or emphasizing it in some other way. However, these logical formatting tags were created to emphasize the semantic characteristics of the content :

For example, the del tag makes the content strikethrough, while indicating the purpose of deleting the text primarily.

trrui

Paragraph formatting elements

  • To move to another line of text, use the empty <br> element.
  • To highlight a paragraph within text, the <p> element is used, the content of which is the paragraph itself. Indents are added before and after the paragraph, but there is no indentation.

jsrsr

Example of using <br> and <p> tags together:

opl

HTML Assignment 1.
Download the text from the link below. Using an editor or Notepad, format the document properly, adding any tags you deem necessary (headings, font formatting tags, and paragraph tags).Desired result:

8989

 

Font color and typeface

The <font> tag exists for font formatting. However, this tag is rarely used anymore.

<font></font>

The tag is used only with its attributes:

  • size — font size, from 1 to 7 ( 3 is the base size, 6 is the size of the H1 heading)
  • face – font family ( serif – serif, sans-serif – serif or sans serif, monospace – monospaced)
  • color — color

Example:

< font  size = "4"  color = "#ff0000"  face = "Arial, Verdana, sans-serif" >
Red text, sans serif font
< / font >

Result in the browser:


Red text, sans-serif font

Special characters

        html code 
© 	 © 	  Copyright
 ® 	 ® 	  Registered trademark
         &trаde;   Trademark
	  &shу; 	  Soft hyphen
 × 	 ×   Multiply
 ÷ 	 &dividе; Divide
 ± 	 &рlusmn; Plus/minus
 	  	  Less than or equal to
 	 &gе; 	  Greater than or equal to
HTML Task 2:
Download the text file for the task and the image. Using an editor or Notepad, format the document to make the result as similar to the image as possible.
HTML Task 3:
Download the text file for the task. Open the file in a code editor (e.g., Notepad++ ). Complete all the tasks listed in the HTML comments one by one. Test the result in a browser.

Explore More IT Terms


Share this term: Facebook X LinkedIn WhatsApp Email
CONTINUE LEARNING Next: Creating Lists →

Leave a Reply

Your email address will not be published. Required fields are marked *