Lecture5 B
Lecture5 B
• Practice:
– download the "c8_e1.zip“ file from the
following address:
http://www.cs.pitt.edu/~mehmud/cs134-2084/
files/c8_e1.zip
– 1) Insert "image2.jpg" in "about.html" file;
2) Insert "image3.jpg" in "index.html" and
also in "assign1.html";
3) Make a link to "about.html",
"assign1.html", "assign2.html" files in the
"index.html" file.
Using Different CSS Selectors
• Type Selector
– redefines the look of a specific tag
– A type selector matches every instance of the element
type in the document tree
E.g. body {background-color: #000000;}
• Class Selector
– can apply to any tag
E.g. .indent{margin-right:5%;margin-left: 5%;}
In HTML, <p class=“indent”>
• ID Selector
E.g. #myId {color: #38608A;}
In HTML, <h1 id="myId">some text..</h1>
Using Different CSS Selectors
• Grouping
– When several selectors share the same
declarations, they may be grouped into a
comma-separated list.
e.g. h1, h2, h3 {font-family: Georgia;}
• Universal selector
– The universal selector, written "*", matches
the name of any element type.
– e.g. * {border: 2px;}
Using Different CSS Selectors
• Descendant selector
– Sometimes, you want selectors to match an
element that is the descendant of another
element in the document tree
(e.g., "Match those EM elements that are
contained by an H1 element").
– Descendant selectors express such a
relationship in a pattern.
– A descendant selector is made up of two or
more selectors separated by whitespace.
e.g. h1 em {color: blue;}
Using Different CSS Selectors
• Practice
– Save the HTML file at the following address
to your local hard drive:
http://www.cs.pitt.edu/~mehmud/cs134-
2084/exercise/orion.html
– Add following CSS rules into orion.html as
internal stylesheet:
*, h1, h2, h6,
h1, h2, h6
, p, .yellowBG, #topcontent, ul li a, #selectedli
– I explain how you should add them