B C D H I L R

CSS

What is CSS?

CSS (Cascading Style Sheets) is a language used to define the visual appearance and layout of web pages. CSS is used to style elements on a webpage, such as text, images, buttons, and forms.

An example of CSS code is:

h1 {
  color: blue;
  font-size: 24px;
  text-align: center;
}

This code is used to define the style of headings (h1 elements) on a webpage. The properties „color“, „font-size“, and „text-align“ are used to define the color, font size, and alignment of the heading.

Another example of CSS code is:

button {
  background-color: green;
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
}

This code is used to define the style of buttons on a webpage. The properties „background-color“, „color“, and „padding“ are used to define the background color, text color, and spacing within the button. The „border-radius“ property is used to round the corners of the button.

Overall, CSS is an important tool for styling and enhancing the appearance of web pages. It allows developers to easily modify and customize the visual design of web pages.

CSS defines the formatting for the various elements of HTML. Selectors are, for example, HTML elements such as body, p (paragraph), div (container element).

Classes are selectors that can be assigned to the various elements in HTML, comparable to format templates in Microsoft Word, for example.

In HTML, for example, it is written like this:

<p class="red-text">This text is red.</p>

It will look like this in the browser:

This text is red.

The CSS Zen Garden project impressively demonstrates how one and the same HTML document can be designed completely differently using only CSS.

The different designs:

More: CSS3

Related Glossare