In this video, we will be introducing you to CSS, which stands for cascading style sheets,
CSS describes how HTML elements should be rendered on the browser.
You can write CSS codes 3 ways,
1. Inline, by using the style attribute of an Element, which is what we have been using throughout the html tutorial series, this method is used to add a unique styling to an element
2. Style element, this is by wrapping our css code inside the Style element - for test
3. In an external file with .css extension - With an external stylesheet file, you can change the look of an entire website by changing just one file!. This method is recommend for any serious project you are working on
How do you write CSS
Identify the element you want to style and find the appropriate selector you that can represent it, then you add your style in a block of bracket
Type of Selectors
We have 5 major type of selector, for this video, we will focus on the first one which is the simple selector
This type of selector allows you to find html elements by name, id and class
Find by name, you simple use the name of the element.
Find by class, we need to have assigned the class attribute to the elements with a value, we can use ‘heading’ as the attribute value, then as part of the requirement, we have to use period ’center’ as a selector to create create the style needed for the element
Find by id, same as find by class, but in this class instared of the class attribute, its ID attribute, and in writing the selector, we use # sign in place of the period, and the id used as our value can only be unique in the entire html page