CSS chapters

Chapter 9 of 17

Built-in value functions

Try this in our CSS Compiler →

The idea

CSS includes built-in functions such as rgb(), var(), calc() and translate(). They return values accepted by particular properties; they are not user-defined procedures. A transform changes visual placement without reserving new space in normal flow.

Worked example

button { background: rgb(0, 100, 100); }
button:hover { transform: translateY(-2px); }

What to check

The hover state moves the button visually. Other elements retain their layout positions; using transforms is not the same as changing margin.

Practice task

Add a focus-visible outline so keyboard users get an equally clear state. Keep the outline visible when the button moves.

Check your understanding

Explain the result in your own words before changing the example. Change one thing at a time, compare the result with your prediction, and keep the version that demonstrates the concept clearly.

Try it yourself

Output
Ctrl/Cmd+Enter runs · Ctrl/Cmd+S downloads the project · Local auto-save is always on