Rule set structure:
selector {
property: value;
property: value;
property: value;
property: value;
}
Three types of stylesheets:
Box Model includes margin
, border
, padding
, and content
e.g.
.myclass {
width: 300px;
padding: 50px;
margin: 50px;
border: 10px;
}
Even though width is 300px
, the actual width of the container is width + padding + margin + border
(in this case, 410px
)
box-sizing: border-box
will include width+height of the border and the width+height of the
padding in the width+height calculation
ul li
<li>
sol > li
<li>
s in <ol>
but not nested <ul>
li.myClass + li
<li>
neighbor after the <li>
that has myClass on it)li.myClass ~ li
https://plnkr.co/edit/SsytYXVJxof5J8ICcy8B?p=catalogue
element[attribute]
e.g.
img[alt] {}
<img src="image.jpg" alt="accessible" />
alt
attributeE[attr]
E[attr="val"]
E[attr|=val]
val-
e.g.
p[lang|="en"] {}
matches <p lang="en-us"><p lang="en-uk">
E[attr~=val]
val
a[title~=more]
matches <a title="want more info"/>
E[attr^=val]
Element E with attribute attr starts with value val
e.g. a[href^=mailto]
E[attr$=val]
Element E with attribute attr ends with val
e.g. a[href$=pdf]
E[attr*=val]
Element E with attribute attr matches val
anywhere within the attribute