css
  1. css-properties

CSS Properties

CSS (Cascading Style Sheets) is a language used to style a web page.

CSS properties are used to define the visual appearance of HTML elements on a web page.

Here are some of the most commonly used CSS properties:

1. Color

The color property is used to set the text color of an HTML element. Here is an example of how to use the color property:

p {
  color: blue;
}

This will set the text color of all <p> elements on the page to blue.

2. Font-Size

The font-size property is used to set the size of the text of an HTML element. Here is an example of how to use the font-size property:

p {
  font-size: 25px;
}

This will set the font size of all <p> elements on the page to 25 pixels.

3. Background-Color

The background-color property is used to set the background color of an HTML element. Here is an example of how to use the background-color property:

body {
  background-color: yellow;
}

This will set the background color of the entire web page to yellow.

4. Border

The border property is used to set the border of an HTML element. Here is an example of how to use the border property:

img {
  border: 1px solid black;
}

This will set a 1-pixel black border around all <img> elements on the page.

5. Margin

The margin property is used to set the space between the element's border and the next element of an HTML element.

p {
  margin: 30px;
}

This will set a 30-pixel margin around all <p> elements on the page.

6. Padding

The padding property is used to set the space between the element's content of an HTML element.

p {
  padding: 30px;
}

This will set a 30-pixel padding around all <p> elements on the page.

Summary

CSS properties are used to define the visual appearance of HTML elements on a web page. Understanding how to use CSS properties is essential for creating well-designed and functional web pages. There are many resources available online to help you learn CSS properties, including tutorials and documentation.

Published on: