Module 8: Using Internal CSS Module 8: Using Internal CSS
Module 8: Using Internal CSS Module 8: Using Internal CSS
Module 8: Using Internal CSS Module 8: Using Internal CSS
CSS
Internal CSS
• Internal CSS may be used if one single page has a
unique style.
• Internal CSS are defined within the <style> and
</style> tags, inside the <head> section of an
HTML page.
Internal CSS
• A CSS rule-set should be followed when using
Internal CSS.
• A CSS rule-set consists of a selector and a
declaration block.
Internal CSS
Element Selector
• Let’s try to edit Laboratory3.html to fully
understand how internal CSS and element selector
works
Laboratory
Exercise 14
Using Internal CSS
Instructions
• Open laboratory4.html
• Save the file as Laboratory14.html
• Change the title to Laboratory 14
• Transfer all the inline style to internal CSS using
element selectors.
The id selector
• The id selector uses the id attribute of an HTML
element to select a specific element.
• The id of an element should be unique within a
page, so the id selector is used to select one
unique element.
• To select an element with specific id, write a hash
character (#), followed by the id of the element.
• An id name cannot start with a number.
Activity 36
Activity 37
The id selector
• Let’s try to edit Laboratory5.html to fully
understand how internal CSS and id selector works
The class selector
• The class selector selects elements with a specific
class attribute.
• To select elements with a specific class, write a
period (.) character, followed by the name of the
class.
• A class name cannot start with a number.
• HTML elements can also refer to more than one
class
Activity 38
Activity 39