Learn To Style HTML Using CSS - Learn Web Development - MDN
Learn To Style HTML Using CSS - Learn Web Development - MDN
Prerequisites
You should learn the basics of HTML before attempting any CSS. We recommend that you
work through our Introduction to HTML module first.
Once you understand the fundamentals of HTML, we recommend that you learn further
HTML and CSS at the same time, moving back and forth between the two topics. This is
because HTML is far more interesting and much more fun to learn when you apply CSS, and
you can't learn CSS without knowing HTML.
Before starting this topic, you should also be familiar with using computers and using the web
passively (i.e., just looking at it, consuming the content). You should have a basic work
environment set up, as detailed in Installing basic software, and understand how to create
and manage files, as detailed in Dealing with files — both of which are parts of our Getting
started with the web complete beginner's module.
It is also recommended that you work through Getting started with the web before
proceeding with this topic, especially if you are completely new to web development.
However, much of what is covered in its CSS basics article is also covered in our CSS first
steps module, albeit in a lot more detail.
Modules
https://developer.mozilla.org/en-US/docs/Learn/CSS 1/4
3/6/24, 16:34 Learn to style HTML using CSS - Learn web development | MDN
This topic contains the following modules, in a suggested order for working through them.
You should start with the first one.
CSS first steps
CSS (Cascading Style Sheets) is used to style and layout web pages — for example, to alter
the font, color, size, and spacing of your content, split it into multiple columns, or add
animations and other decorative features. This module provides a gentle beginning to your
path towards CSS mastery with the basics of how it works, what the syntax looks like, and
how you can start using it to add styling to HTML.
CSS building blocks
This module carries on where CSS first steps left off — now you've gained familiarity with
the language and its syntax, and got some basic experience with using it, it's time to dive a
bit deeper. This module looks at the cascade and inheritance, all the selector types we
have available, units, sizing, styling backgrounds and borders, debugging, and lots more.
The aim here is to provide you with a toolkit for writing competent CSS and help you
understand all the essential theory, before moving on to more specific disciplines like text
styling and CSS layout.
CSS styling text
With the basics of the CSS language covered, the next CSS topic for you to concentrate on
is styling text — one of the most common things you'll do with CSS. Here we look at text
styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop
shadows, and other text features. We round off the module by looking at applying custom
fonts to your page, and styling lists and links.
CSS layout
At this point, we've already looked at CSS fundamentals, how to style text, and how to style
and manipulate the boxes that your content sits inside. Now it's time to look at how to place
your boxes in the right place with respect to the viewport, and one another. We have
covered the necessary prerequisites so we can now dive deep into CSS layout, looking at
https://developer.mozilla.org/en-US/docs/Learn/CSS 2/4
3/6/24, 16:34 Learn to style HTML using CSS - Learn web development | MDN
different display settings, modern layout tools like flexbox, CSS grid, and positioning, and
some of the legacy techniques you might still want to know about.
"CSS is weird"
CSS works a bit differently from most programming languages and design tools you'll come
across. Why does it work the way it does? In the following video, Miriam Suzanne provides a
useful explanation of why CSS works as it does, and why it has evolved as it has:
https://developer.mozilla.org/en-US/docs/Learn/CSS 3/4
See also
3/6/24, 16:34 Learn to style HTML using CSS - Learn web development | MDN
CSS on MDN
The main entry point for CSS documentation on MDN, where you'll find detailed reference
documentation for all features of the CSS language. Want to know all the values a property
can take? This is a good place to go.
https://developer.mozilla.org/en-US/docs/Learn/CSS 4/4