you also need lecture #5
Learn today:
selector:pseudo-class
e.g.
a:hover
pseudo-selector | description |
---|---|
:target | a document fragment that match the URL (ju.se#id) |
a:link | unvisited link |
a:visited | visited link |
:hover | when mouse is over the selector |
:active | mouse is pressed down (links and buttons) |
interactive pseudo classes
selector | description |
---|---|
p:not(.red) | all <p> except <p class="red"> |
li:first-child | first element in a group of siblings |
li:last-child | last element in a group of siblings |
li:nth-child(n+1) | select which child in a group of siblings |
advanced selectors
nth-child demo: https://codepen.io/jkohlin/pen/eYZLqRK
<img src="" alt="">
Did you know that water melon consists of only 5% water? Well according to pseudo science this fruit is mainly made out of carbon fibers and sugar. The liquid feel is just imaginary.
roses are red
violets are blue
I love you
descriptive image
decorative image
figure & figcaption
<figure> + <figcaption>
<figure>
<img src="flower.jpg" alt="">
<figcaption>
A flower
</figcaption>
</figure>
only set either to keep proportions, or use with...
fill (default, stretch out)
contain (don't crop, shrink to smallest of width/height)
cover (crop top and bottom)
none (original size, cropped to width & height)
scale-down (whichever is smallest of contain or none)
a CSS property for decorative images
.banner{
background-image: url('../img/top-image.png');
background-repeat: no-repeat; /* repeat-x or repeat-y*/
background-position-x: center; /* left right 50% 10px*/
background-position-y: top; /* bottom center... */
background-size: cover; /* contain 50% 250px */
background-attachment: fixed; /* scroll */
}
how to position an element
how much to move the element
The default position
the element will not be affected by
top, bottom left or right.
Keep your seat, but be movable
free flying, not part of the flow
like a post-it on your screen
scrolls until it sticks
Read/Do Chapter 16 - Flexbox