This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
notes:css_cheat_sheet [2026/07/21 07:33] 47.79.202.42 old revision restored (2026/06/21 11:12) |
notes:css_cheat_sheet [2026/07/24 19:48] (current) 14.176.159.225 old revision restored (2026/07/19 15:42) |
||
|---|---|---|---|
| Line 10: | Line 10: | ||
| * Styles define how to display HTML elements. Style sheets are collections of styles. | * Styles define how to display HTML elements. Style sheets are collections of styles. | ||
| * Multiple style sheets will cascade into a single style definition. | * Multiple style sheets will cascade into a single style definition. | ||
| - | * Styles can be specified inside | + | * There are 3 ways to specify styles (decreasing priority): |
| - | | + | - inline as an element |
| - | * Multiple property-value pairs may be separated by semi-colons. | + | - in an internal style sheet in the head <code html> |
| - | * Multiple selectors must be separated by commas | + | < |
| - | * Values must be quoted if they are multiple words | + | <!-- |
| + | hr {color: sienna} | ||
| + | --> | ||
| + | </ | ||
| + | - in an external | ||
| + | <link rel=" | ||
| + | href=" | ||
| + | |||
| + | |||
| + | ==== CSS Syntax==== | ||
| + | CSS syntax is made up of three parts - selector {property: value}. | ||
| + | * Multiple property-value pairs may be separated by semi-colons. | ||
| + | * Multiple selectors must be separated by commas | ||
| + | * Values must be quoted if they are multiple words | ||
| * A simple example <code html> | * A simple example <code html> | ||
| h1,h2,h3 { | h1,h2,h3 { | ||
| Line 20: | Line 33: | ||
| color: black; | color: black; | ||
| font-family: | font-family: | ||
| + | * Classes allow groups of elements to share formatting e.g. <code html> | ||
| + | p.right {text-align: | ||
| + | .blue {color: blue} | ||
| + | <p class=" | ||
| + | * Styles can also match on attribute values or id e.g. <code html> | ||
| + | input[type=" | ||
| + | #id {background-color: | ||
| + | p#id {background-color: | ||
| + | * CSS uses C-style comments - /* comment */ . | ||
| + | |||
| + | ==== CSS Properties ==== | ||
| + | * Background properties examples <code html> | ||
| + | background-color: | ||
| + | background-image: | ||
| + | background-repeat: | ||
| + | background-attachment: | ||
| + | background-position: | ||
| + | background: blue url(' | ||
| + | </ | ||
| + | * Text properties examples <code html> | ||
| + | |||