Style Terms


Page sections

1-3 A 1 Discover 1-3 A 2 1-3 A 3 Four single style declarations 1-3 A 4 1-3 A 5 1-3 A 6 1-3 A 7 1-3 A 8 1-3 A 9 1-3 A 10 1-3 A 11 1-3 A 12 1-3 A 13 1-3 A 14 StarfruitJuice03.html 1-3 Definition 1: Property values 1-3 Definition 2: Style 1-3 Definition 3: Style declaration 1-3 Definition 4: Syntax in HTML 1-3 Definition 5: Attribute 1-3 Definition 6: Style attribute 1-3 Example 1: Property name 1-3 Example 2: Property values 1-3 Example 3: Style declaration 1-3 Example 4: Collection of style declarations 1-3 Example 5: Style declaration 1-3 Example 6: A style attribute with several style declarations 1-3 Example 7: Style attribute 1-3 Example 8: Style attribute 1-3 Example 9: The align style 1-3 Explanation 1: Displaying text with the paragraph tag pair 1-3 Explanation 2: Element, style, tag name, style attribute, property name, property value, content 1-3 Explanation 3: Property value 1-3 Explanation 4: Property values 1-3 Explanation 5: Style declaration 1-3 Explanation 6: Purpose of styles 1-3 Explanation 7: Attribute 1-3 Explanation 8: Styles of a style attribute 1-3 Explanation 9: The style attribute declaration 1-3 Explanation 10: Style attributes 1-3 Explanation 11: The style attribute 1-3 Explanation 12: Values for the text-align property 1-3 Orientation 1: Review of HTML terms 1-3 Orientation 2: Style terms 1-3 Orientation 3: Definition element 1-3 Orientation 4: The Exercises01 folder. 1-3 Orientation 5: Spotting syntax errors 1-3 Orientation 6: HTML tag pairs and styles covered in this HTML workbook 1-3 Submit 1: Interactive review of HTML terms 1-3 Submit 2: Syntax errors I 1-3 Submit 3: Syntax errors II 1-3 Submit 4: Syntax errors III

Workbook pages

1. Settings. Line breaks and paragraphs.

2. Commenting code and checking your StarfruitJuice files

3. Style Terms

4. Headings

5. Fonts and Colors.

6. Simplified HTML structure. Colors.

7. Ordered and unordered lists

8. More List Styles

9. Font Families and Font Sizes

10. Bold, Italic and Underline

11. Tables. Online HTML Editor.

12. Including images in Tables

13. Visual Studio Code. Table Colors.

14. Table Headings and Heights of Table Rows

15. Table Sizes, Borders and Alignments

16. Rice Files

17. Hyperlinks

18. Further studies

1-3 Orientation 1: Review of HTML terms

Before studying this page, carry out the following interactive review of HTML terms.

1-3 Submit 1: Interactive review of HTML terms

Click here.


1-3 Orientation 2: Style terms

The following sections define and explain style terms.

1-3 A 1 Discover

Hello. Hello.
<p style="color:red;">Hello.</p>
Hello. Hello. Hello.<br>
Hello. Hello.

Open this file in a browser and explain what <p style="color:red;"></p> does:





































1-3 Explanation 1: Displaying text with the paragraph tag pair

<p specific instructions>This is a little text.</p>

Specific instructions, written within the opening tag of a paragraph tag pair, can be used to modify the appearance of the text within the paragraph tag pair, in a browser.


1-3 Orientation 3: Definition element

Review the definition of the word element, which you can find on page 1.

1-3 Explanation 2: Element, style, tag name, style attribute, property name, property value, content

This element: <p style="color:blue;font-style:italic;">Hello.</p> will display the text Hello. in blue and italicised: Hello.
Compare the element to this illustration:          

1-3 Example 1: Property name

When displayed in a browser, the property name of the color property specifies the color of an element's text:          

1-3 Definition 1: Property values

Values assigned to a property are called property values.

1-3 Example 2: Property values

Various property values can be assigned to the color property:

<p style="color:red;">Hello.</p>
<p style="color:green;">Hello.</p>
<p style="color:blue;">Hello.</p>

Here the red, green and blue property values will display:

Hello.


Hello.


Hello.


         

1-3 Explanation 3: Property value

A property value specifies how the content of an element is displayed in a browser.

1-3 Orientation 4: The Exercises01 folder.

Continue with the following exercises inside the Exercises01 folder.

1-3 A 2

Create an HTML file that displays these three words:

Hello.

Hello.

Hello.



1-3 Explanation 4: Property values

Several property values such as blue, red or green can be assigned to the color property.
Several properties such as italic, bold or underline can be assigned to the font-style property.

         

1-3 Example 3: Style declaration

This is an example of a style declaration:          

1-3 Explanation 5: Style declaration

A style declaration consists of a property name, a colon and a property value.          

1-3 Definition 2: Style

A single style declaration or a collection of style declarations is called a style.

1-3 Example 4: Collection of style declarations

Below, you can find an example of a collection of style declarations:

color:blue;font-style:italic;

1-3 Explanation 6: Purpose of styles

Styles describe how text formatting, colors and numerous other properties will be displayed in a browser.

1-3 Definition 3: Style declaration

A single statement, that defines a distinct styling feature, is called a style declaration.

1-3 Example 5: Style declaration

In this style declaration, the single statement is: color:blue. The styling feature it defines, is the color blue.          

1-3 A 3 Four single style declarations

  1. create an HTML file with the following code:

       <p style="font-weight:bold;">This sentence is displayed in bold.</p>
       <p style="font-style:italic;">This sentence is displayed in italics.</p>
       <p style="text-decoration:underline;">This sentence is displayed with an underline.</p>
       <p style="color:blue;">This sentence is displayed in blue.</p>

  1. open the file in a browser


1-3 Definition 4: Syntax in HTML

In HTML, the term syntax refers to the rules for writing and arranging elements, tags, and symbols. The symbols include letters, numbers, and special characters such as periods, colons, semicolons, brackets, angle brackets, quotation marks, and equals signs.

period .
colon :
semicolon ;
brackets ( and )
angle brackets < and >
quotation marks " or '
equals sign =

1-3 Orientation 5: Spotting syntax errors

The next three sections are designed to develop your ability to identify syntax errors, helping you recognize them early and write more efficient, error-free code.
Each exercise appears as an online form. When you have completed a form and clicked the Submit button, you will see the View Accuracy button. When you click that button, the results will be displayed. They are shown in the following three ways:
  • Red text and a red field: This indicates that the answer was not correct.
  • Green text and a red field: This indicates that the answer was correct, but an extra blank space was included at the beginning or end of the code.
  • Green text and a green field: This indicates that the answer was correct.

1-3 Submit 2: Syntax errors I

Complete this form.

1-3 Submit 3: Syntax errors II

Complete this form.

1-3 Submit 4: Syntax errors III

Complete this form.

1-3 A 4

Create an HTML file that displays this text: This is a little text.

1-3 A 5

Create an HTML file that displays this text: This is a little text.

1-3 A 6

Create an HTML file that displays this text: This is a little text.

1-3 A 7

Create an HTML file that displays this text: This is a little text.

1-3 Example 6: A style attribute with several style declarations

In the following example, four style declarations are combined into a single style attribute:
  • font-weight:bold
  • font-style:italic
  • text-decoration:underline
  • color:blue

These style declarations are assigned to the style attribute as follows:
style="font-weight:bold;font-style:italic;text-decoration:underline;color:blue;"

Note that each style declaration ends with a semicolon, including the last one.

When this style attribute is applied to a paragraph element <p>Here is a small sentence.</p> it will look like this:

<p style="font-weight:bold;font-style:italic;text-decoration:underline;color:blue">

This style attribute with several styles will change the appearance of the text: "This is a little text." to make it look like this:

This is a little text.



































1-3 A 8

Create an HTML file that displays this text:

This is a little text.



1-3 Definition 5: Attribute

A specification, that provides additional information about an element or modifies how elements behave, is called an attribute.

1-3 Explanation 7: Attribute

An attribute can be used to change the color, font style and numeours other property values of an HTML elements' content.

1-3 Definition 6: Style attribute

An attribute that specifies how the content of an element is displayed in a browser is called a style attribute.

1-3 Example 7: Style attribute

This style attribute consists of the color style and font-style style:          

1-3 Explanation 8: Styles of a style attribute

A style attribute may consist of one or several styles.

1-3 Explanation 9: The style attribute declaration

A style attribute is declared using a property name and a property value, connected by a colon:          

1-3 Explanation 10: Style attributes

Style attributes are specified in the opening tag of an element.

1-3 Explanation 11: The style attribute

The style attribute of an element can consist of one or more styles.
         

1-3 Example 8: Style attribute

A style attribute may be used to set the its color property to the blue value and its font-style property to the italic value. With:

<p style="color:blue;font-style:italic;">Hello.</p>

"Hello." will be displayed like in blue and italicised: Hello.

1-3 A 9

Create an HTML file that shows this text:

Hello.



1-3 Example 9: The align style

In the style declaration of this paragraph element the style's property name is 'text-align' and its property value is 'center', so the element's content will be center aligned.

Here is the element with the style attribute:
<p style="text-align:center;">This is a little text.</p>

And here you can see how the element's content will be displayed:

This is a little text.


1-3 A 10

Create an HTML file that shows this text:

Hello



1-3 Explanation 12: Values for the text-align property

The text-align property can be assigned the following values:
  1. left
  2. center
  3. right
If the text-align style is not set, then the property will default to left.

1-3 A 11

Create an HTML file that shows these lines:

Hello.

Hello.

Hello.



1-3 A 12

Create an HTML file that shows these lines:

Hello.

Hello.

Hello.



1-3 A 13

<p style="text-align:left">Hello.</p>


Decide if the following statements about the above element are true or false.


 
Yes
No
 
'Style' is an attribute.
'text-align' is a property name.
'Hello' is a property value.
'Left' is a property value.
The above element is a paragraph element.


1-3 Orientation 6: HTML tag pairs and styles covered in this HTML workbook

Download the HTML_TagsStyles.pdf document here. The document lists all HTML tag pairs and styles covered in this HTML workbook. Print it to keep it by your side while studying with the exercises.

1-3 A 14 StarfruitJuice03.html

  1. within the StarfruitJuiceFiles folder, create a copy of the StarfruitJuice02.html file
  2. rename the copy of the StarfruitJuice02.html file to StarfruitJuice03.html

At this point you have 2 identical files, named StarfruitJuice02.html and StarfruitJuice03.html.

  1. modify StarfruitJuice03.html, so it looks exactly like this.
  2. save StarfruitJuice03.html


This page was created by Hanspeter Amend
Previous page   Table of contents

Solution proposals

 

1-3 A 4

<p style="font-weight:bold;">This is a little text.</p>



 

1-3 A 8

<p style="font-weight:bold;font-style:italic;text-decoration:underline;color:blue;">This is a little text.</p>

 

1-3 A 9

<p style="color:red;font-style:italic;">Hello</p>

 

1-3 A 10

<p style="color:red;font-style:italic;text-align:center;">Hello</p>

 

1-3 A 11

<p style="text-align:right;">Hello.</p>
<p style="text-align:center;">Hello.</p>
<p style="text-align:left;">Hello.</p>

 

1-3 A 12

<p style="text-align:left;">Hello.</p>
<p style="text-align:right;">Hello.</p>
<p style="text-align:center;">Hello.</p>


 

1-3 A 14

<!– – Title: Set style attribute for text style. – –>
<p style= "text-align:center;">About the Star Fruit<p>

<!– – Line break – –>
The starfruit, also called carambola, is a sweet and sour fruit that is in the shape of a five-point star.<br>
The skin is edible and the flesh has a mild, sour flavor that makes it popular in a number of dishes.

<!– – Paragraph – –>
<p>The starfruit is yellow or green in color. It comes in two main types: a smaller, sour variety and a larger, sweeter one.</p>





This page was created by Hanspeter Amend Previous page   Table of contents