CSS IS A RULE-BASED LANGUAGE THAT DEFINES THE RULES TO DESIGN A PARTICULAR ELEMENT OR A GROUP OF ELEMENTS ON YOUR WEB PAGE
CSS OR CASCADING STYLE SHEETS IS A STYLING LANGUAGE USED TO ADD STYLES TO THE HTML DOCUMENT. IT DESCRIBES HOW HTML ELEMENTS SHOULD BE DISPLAYED ON THE WEB PAGE
CSS was first proposed by HÅKON WIUM LIE
1994
CSS1 specification published by LIE AND BERT BOS
1996
Reason for using CSS
TO SIMPLIFY THE PROCESS OF MAKING WEB PAGES PRESENTABLE
CSS
ALLOWS WEB DEVELOPERS TO CONTROL THE VISUAL APPEARANCE OF WEB PAGES
Basic CSS Example
CSS HAS 3 WAYS TO STYLE YOUR HTML: INLINE, INTERNAL, EXTERNAL
Inline CSS
AN INLINE STYLE MAY BE USED TO APPLY A UNIQUE STYLE FOR A SINGLE ELEMENT
THE INTERNALCSS STYLESHEET IS A SET OF STYLES CREATED AS PART OF AN HTML DOCUMENT. INTERNAL CSS IS A METHOD FOR DEFINING CSS STYLES WITHIN AN HTML DOCUMENT'S <STYLE> ELEMENT, IT IS USED TO PROVIDE A UNIQUE STYLE FOR A SINGLE HTML DOCUMENT IN THE <HEAD> SECTION
EXTERNALCSS IS USED TO STYLE MULTIPLE HTML PAGES WITH A SINGLE STYLE SHEET. EXTERNAL CSS CONTAINS A SEPARATE CSS FILE WITH A .CSS EXTENSION. THE CSS FILE CONTAINS STYLE PROPERTIES ADDED ON SELECTORS (FOR EXAMPLE CLASS, ID, HEADING, … ETC.)
A CSS SYNTAX RULE CONSISTS OF A SELECTOR, PROPERTY, AND ITS VALUE. THE SELECTOR POINTS TO THE HTML ELEMENT WHERE THE CSS STYLE IS TO BE APPLIED. THE CSS PROPERTY IS SEPARATED BY SEMICOLONS. IT IS A COMBINATION OF THE SELECTOR NAME FOLLOWED BY THE PROPERTY: VALUE PAIR THAT IS DEFINED FOR THE SPECIFIC SELECTOR
CSS Syntax
DECLARATION: A COMBINATION OF A PROPERTY AND ITS CORRESPONDING VALUE
SELECTOR: USED TO TARGET AND SELECT SPECIFIC HTML ELEMENTS TO APPLY STYLES TO
PROPERTY: DEFINES THE SPECIFIC ASPECT OR CHARACTERISTIC OF AN ELEMENT THAT YOU WANT TO MODIFY
VALUE: ASSIGNED SETTING OR PARAMETER FOR A GIVEN PROPERTY, DETERMINING HOW THE SELECTED ELEMENT SHOULD APPEAR OR BEHAVE
ELEMENT - THE ELEMENT SELECTOR SELECTS HTML ELEMENTS BASED ON THE ELEMENT NAME
ID - THE ID SELECTOR USES THE ID ATTRIBUTE OF AN HTML ELEMENT TO SELECT A SPECIFIC ELEMENT. THE ID OF AN ELEMENT IS UNIQUE WITHIN A PAGE, SO THE ID SELECTOR IS USED TO SELECT ONE UNIQUE ELEMENT! TO SELECT AN ELEMENT WITH A SPECIFIC ID, WRITE A HASH (#) CHARACTER, FOLLOWED BY THE ID OF THE ELEMENT
CLASS - THE CLASS SELECTOR SELECTS HTML ELEMENTS WITH A SPECIFIC CLASS ATTRIBUTE. TO SELECT ELEMENTS WITH A SPECIFIC CLASS, WRITE A PERIOD (.) CHARACTER, FOLLOWED BY THE CLASS NAME