css · level 3 · unit 5 · lesson 2
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
turns a box, and resizes it.
rotate turns a box clockwise around its middle. Angles are in degrees, written deg: 90deg is a quarter turn and 360deg a full circle. You can also write turns, so 0.25turn is that same quarter turn.
scale resizes how a box is drawn. 1 is normal, 1.1 is ten percent bigger and 0.5 is half. Give it two values to scale across and down separately.
Like translate, both leave the layout alone. A scaled card can overlap its neighbours, but it never pushes them.
<div class="sticker">Sale</div> .sticker {
display: inline-block;
padding: 12px;
rotate: -8deg;
scale: 1.2;
background-color: gold;
} Press show my page to see it here.
guess first
What does scale: 1 0.5 do to the bar?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<div class="bar">Loading</div> .bar {
width: 200px;
scale: 1 0.5;
background-color: #e0f2f1;
}
your turn
Your turn. Tilt the price tag.
Fill in the blanks: turn the tag 12 degrees anticlockwise and make it ten percent bigger.
the page you’re styling
<span class="tag">£9.99</span>your css
Press show my page to see it here.
- the tag turns 12deg anticlockwisenot checked yet
- the tag is ten percent biggernot checked yet
fix it
The plus will not turn into a cross. Can you fix it?
the page you’re styling
<span class="icon">+</span>your css
Press show my page to see it here.
- the plus turns into a crossnot checked yet
- The browser skipped the
rotateline. Look closely at its value. - An angle needs a unit, the way a length needs
px. - Write
rotate: 45deg;, then press run.
nailed it
you turned and resized boxes. :D
rotateusesdegorturn; negative turns anticlockwise.scale: 1.1draws a box ten percent bigger.- Neither one pushes the boxes around it.
new words in your collection
- rotate
- degree
- scale
This lesson isn’t saved. A free account remembers every lesson you finish.