Free Ebook cover Complete HTML, CSS and Javascript course to become a Front End Developer

Complete HTML, CSS and Javascript course to become a Front End Developer

3.79

(14)

125 pages

Introduction to CSS: selectors, properties and values: Introduction to values ​​in CSS

Capítulo 50

Estimated reading time: 3 minutes

+ Exercise
Audio Icon

Listen in audio

0:00 / 0:00

CSS (Cascading Style Sheets) is a style language used to describe the appearance and formatting of a document written in HTML. It is mainly used to add style to web pages and user interfaces written in HTML and XHTML. In this section, we will focus on selectors, properties, and values ​​in CSS.

CSS Selectors

CSS selectors are the part of CSS that selects the HTML element you want to style. There are several types of selectors in CSS, including type selectors, class selectors, ID selectors, attribute selectors, pseudo-class selectors, and pseudo-element selectors.

Type selectors select elements based on their HTML tag name. For example, the type selector 'p' selects all elements <p> on one page.

Class selectors select elements based on the value of the class attribute. For example, the class selector '.intro' selects all elements that have 'intro' as the value of their class attribute.

ID selectors select an element based on the value of the ID attribute. For example, the ID selector '#name' selects the element that has 'name' as the value of its ID attribute.

Continue in our app.

You can listen to the audiobook with the screen off, receive a free certificate for this course, and also have access to 5,000 other free online courses.

Or continue reading below...
Download App

Download the app

CSS Properties

CSS properties are what you want to style in the selected element. These can be things like color, font size, spacing, border, etc. Each property has a name and a value, separated by a colon. For example, 'color: red;' is a CSS property declaration, where 'color' is the property name and 'red' is the value.

There are hundreds of CSS properties, each with its own set of possible values. Some properties are specific to certain element types, while others can be used on any element type.

CSS Values

CSS values ​​are the specific details you want to apply to the property. For example, if you are using the 'color' property, the values ​​could be 'red', 'blue', 'green', etc. If you are using the 'font-size' property, the values ​​could be '12px', '14px', '16px', etc.

Values ​​can be numbers, colors, percentages, URLs, among other things. They can also be relative or absolute values. An absolute value is a fixed value, such as '12px'. A relative value is a value that is relative to something else, like '50%'.

Also, there are some special keywords that can be used as values, such as 'inherit', 'initial' and 'unset'. 'Inherit' causes the element to inherit the value of its parent element. 'Initial' sets the property to its initial value. 'Unset' is a combination of 'inherit' and 'initial'.

In summary, selectors, properties, and values ​​in CSS are powerful tools that allow you to style your HTML documents in very flexible and detailed ways. With a good understanding of how they work, you can create stunning and effective web designs.

Now answer the exercise about the content:

What are selectors, properties and values ​​in CSS and how are they used?

You are right! Congratulations, now go to the next page

You missed! Try again.

In CSS, selectors are used to choose the HTML elements you want to apply styles to. Properties are attributes you want to style, such as color or font size. Values are the specifics of the styling, like the exact color or size. This relationship allows for flexible and detailed styling of web pages.

Next chapter

Introduction to CSS: selectors, properties and values: Different types of values ​​in CSS: Colors, Sizes and Units

Arrow Right Icon
Download the app to earn free Certification and listen to the courses in the background, even with the screen off.