Midterms - Cascading Style Sheets Flashcards
combinator matches all elements that are descendants of a specified element.
descendant (space)
div p { background-color: yellow; }
combinator selects all elements that are the children of a specified element.
Child Combinator (>)
div > p { background-color: yellow; }
combinator is used to select an element that is directly after another specific element
Adjacent Sibling Combinator (+)
combinator selects all elements that are next siblings of a specified element.
General sibling combinator (~)
is used to define a special state of an element.
pseudo-class
The syntax of pseudo-classes:
selector:pseudo-class { property: value; }
pseudo-class matches a specified element that is the first child of another element.
:first-child
pseudo-class allows you to define special rules for different languages
:lang
is used to style specific parts of an element.
pseudo-element
The syntax of pseudo-elements:
selector::pseudo-element { property: value; }
pseudo-element is used to add a special style to the first line of a text.
::first-line
pseudo-element is used to add a special style to the first letter of a text.
::first-letter
pseudo-element can be used to insert some content before the content of an element.
::before
pseudo-element can be used to insert some content after the content of an element.
::after
pseudo-element selects the markers of list items.
::marker
pseudo-element matches the portion of an element that is selected by a user.
::selection
property specifies the opacity/transparency of an element.
opacity
img { opacity: 0.5; }
is basically a list of links, so using the <ul> and <li> elements
navigation bar
<ul> <li><a href="default.asp">Home</a></li> <li><a href="news.asp">News</a></li> <li><a href="contact.asp">Contact</a></li> <li><a href="about.asp">About</a></li> </ul>
Displaying the links as block elements makes the whole link area clickable
display: block
selector is used to select elements with a specified attribute and value.
[attribute=”value”]
selector is used to select elements with an attribute value containing a specified word.
[attribute~=”value”]
selector is used to select elements with the specified attribute, whose value can be exactly the specified value, or the specified value followed by a hyphen (-)
[attribute|=”value”]
selector is used to select elements with the specified attribute, whose value starts with the specified value.
[attribute^=”value”]
selector is used to select elements whose attribute value ends with a specified value.
[attribute$=”value”]
selector is used to select elements whose attribute value contains a specified value.
[attribute*=”value”]