CSS- Cascading Style Sheets
How to display HTML elements
External style sheets are stored in css files
W3C created CSS
All browsers support CSS
CSS defines how HTML elements are displayed
Has two main parts:
Selector
HTML element you want to style
Declaration
Consists of a property and a value
Property- style attribute you want to change
Each property has a value
Each declaration ends with a semicolon and are surrounded by curly brackets
Can also add comments- do this by starting off code with “/*” and end with */”
Id selector
Used to specify a style for a single, unique element
Demarcate with a # sign
Class selector
used to specify a style for a group of elements.
Demarcate with a “.”
3 ways to inserts CSS
External style sheet
Ideal when applied to many pages
Use the tag
Can be written in any text editor
Shouldn’t contain any html tags
Internal style sheet
Used when a single document has a unique style
Use the tag
Inline style
Not as good as others- loses this by mixing content with presentation
No comments:
Post a Comment