Site Tools


Hotfix release available: 2026-07-14a "Mort". upgrade now! [57.1] (what's this?)
New release available: 2026-07-14 "Mort". upgrade now! [57] (what's this?)
Hotfix release available: 2025-05-14b "Librarian". upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian". upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian". upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)
notes:css_cheat_sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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 an HTML element, inside the <head> element or in an external CSS file - in that order of priority+  * There are 3 ways to specify styles (decreasing priority): 
-  CSS syntax is made up of three parts - selector {property: value}. +    - inline as an element style attribute <code html> <p style="color: sienna>text</p></code> 
-    * 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 + <head> <style type="text/css"> 
-    * Values must be quoted if they are multiple words +<!-- 
 +hr {color: sienna} 
 +--> 
 +</style> </head></code> 
 +    - in an external style sheet in a css file <code html> 
 +<link rel="stylesheet" type="text/css" 
 +href="style.css" /> </code> 
 + 
 + 
 +==== 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: "sans serif" } </code> font-family: "sans serif" } </code>
 +  * Classes allow groups of elements to share formatting e.g. <code html>
 +p.right {text-align: right}
 +.blue {color: blue}
 +<p class="right blue">right-aligned blue text</p> </code>
 +  * Styles can also match on attribute values or id e.g. <code html>
 +input[type="text"] {background-color: blue}
 +#id {background-color: blue}
 +p#id {background-color: blue} </code>
 +  * CSS uses C-style comments - /* comment */ .
 +
 +==== CSS Properties ====
 +  * Background properties examples <code html>
 +background-color: black;
 +background-image:  url('bg.jpg');
 +background-repeat: repeat-[x|y]/no-repeat/repeat;
 +background-attachment: fixed
 +background-position: center/30% 20%/50px 100px;
 +background: blue url('bg.gif') no-repeat fixed center; 
 +</code>
 +  * Text properties examples <code html>
 +
notes/css_cheat_sheet.1784644396.txt.gz · Last modified: 2026/07/21 07:33 by 47.79.202.42