CSS PROPERTIES /// COLORS /// BACKGROUNDS /// TYPOGRAPHY /// BOX MODEL /// CSS PROPERTIES /// COLORS /// BACKGROUNDS /// TYPOGRAPHY ///

CSS Properties

The core building blocks of styling. Learn to paint colors, set gorgeous typography, and construct robust layouts with the Box Model.

properties.css
1 / 12
12345

Tutor:Welcome to CSS Properties. HTML gives us structure, but CSS properties give us style, layout, and beauty. Let's start basic.


Properties Matrix

UNLOCK NODES BY MASTERING STYLING.

Concept: Colors

Control the foreground and background painting of your HTML elements.

System Check

Which property changes the color of the text?


Community Holo-Net

Showcase Your Styling

ACTIVE

Created a gorgeous layout? Share your codepens and get feedback on your color palettes!

CSS Properties: The Building Blocks of Style

Author

Pascual Vila

Frontend Instructor // Code Syllabus

HTML provides the skeleton, but CSS properties breathe life into your web pages. Understanding the core properties is the first step toward mastering frontend development.

Paint It Black (or Any Color)

The most immediate visual impact comes from colors. The color property defines the color of the text, while background-color fills the element's container.

You can use named colors (red), HEX codes (#FF0099), RGB (rgb(255, 0, 153)), or HSL. HSL is often preferred by designers because it's easier to create harmonious palettes by tweaking lightness and saturation.

Typography Controls

Text isn't just readable; it's visual. With font-family, you define the typeface. Always provide fallbacks (like sans-serif) in case the user's browser doesn't load your custom font.

font-size dictates how large the text is, and font-weight makes it bold (700) or light (300). Use text-align to center or justify your paragraphs within their containers.

The CSS Box Model

Every single HTML element is evaluated as a rectangular box by the browser. To master layout, you must master the Box Model:

  • Content: The actual text or image. Controlled by width and height.
  • Padding: The transparent space INSIDE the border, between the content and the edge.
  • Border: The line wrapping the padding and content. Set via border (width, style, color).
  • Margin: The transparent space OUTSIDE the border, pushing other elements away.
Pro Tip: box-sizing+

Always use box-sizing: border-box;. By default, adding padding to an element increases its overall width. By setting it to border-box, the padding is absorbed into the assigned width, making math and layouts much easier to manage!

Preguntas Frecuentes

What is the difference between padding and margin?

Padding is the inner space. It is located between the content and the border of the element. The element's background color fills the padding.

Margin is the outer space. It pushes the element away from other elements around it. It is completely transparent.

Why isn't my 'color' property changing the background?

A very common mistake when starting out is confusing color with the background. In CSS, color refers strictly to the font (text) color. If you want to change the background of the container element, you must use background-color.

What is shorthand notation?

Many CSS properties allow you to write several characteristics in a single line. For example, instead of writing margin-top, margin-right, etc., you can write margin: 10px 20px 10px 20px; (order: top, right, bottom, left—just like the hands of a clock).

CSS Properties Glossary

color
Establece el color del texto o contenido en primer plano de un elemento.
background-color
Define el color de fondo del área de contenido y padding de un elemento.
font-family
Especifica una lista priorizada de nombres de familias tipográficas a usar.
font-size
Ajusta el tamaño de la fuente. Puedes usar px, rem, em, o porcentajes.
text-align
Alinea horizontalmente el texto dentro de su contenedor (left, center, right, justify).
border
Shorthand para border-width, border-style, y border-color.
border-radius
Redondea las esquinas del borde exterior de un elemento.
padding
Genera espacio alrededor del contenido, dentro del borde definido.
margin
Crea espacio alrededor del elemento, empujando a los elementos vecinos.
box-shadow
Añade efectos de sombra alrededor del marco (box) de un elemento.