CSS (Cascading Style Sheets) language will give us a way to express information about the appearance of different parts of our content
CSS information (style sheets) will also be edited with a text editor, and saved in ".css" files
Let's say we want to use CSS to change the headings on the page
we want the <h2> elements to be
centred (instead of the default left-justified)
and in an italic font
make a new file call it firststyle.css
h2 {
text-align: center;
font-style: italic;
}
In this example:
Let's link the generated CSS file to the HTML codes
<head>
<meta charset="UTF-8" />
<title>Page with a style sheet</title>
<link rel="stylesheet" href="firststyle.css" />
</head>
* images from http://www.cs.sfu.ca/CourseCentral/165/common/study-guide/figures/withstyle[1/2].png
selectorlist {
property: value;
[more property:value; pairs]
}
... where selectorlist is:
selector[:pseudo-class]
[::pseudo-element]
[, more selectorlists]
* from https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
border properties can be used separately or as a shorthand property border to combine these into one line (giving the three values in any order)
figure {
border-style: solid;
border-width: 3px;
border-color: red;
}
figure {
border: solid red 3px;
}
<h2>Element Contents</h2> Example
h2 {
padding: 1em;
border: medium dashed black;
background-color: grey;
}
emex is half the text size.pxmm
body {
font-family: "Helvetica", sans-serif;
}
h1 {
text-align: center;
font-weight: bold;
background-color: silver;
color: teal;
padding: 0.25em;
}
h2 {
border: medium dotted teal;
font-weight: normal;
padding: 0.1em;
}
* image from http://www.cs.sfu.ca/CourseCentral/165/common/study-guide/figures/css-prop-result.png
* try the result at css-prop-page.html