CSS Properties: Exploration and Usage

Here is the detailed explanation for each CSS property

 

Property color

The color property is used to format the text color of an element.

The value can be a color name (e.g., red, blue, green), a hexadecimal code (e.g., "#FF0000" for red), or an rgb() function to specify the Red, Green, Blue values.

Example: color: red;

Property font-size

The font-size property is used to format the size of the text within an element.

The value can be in pixels (e.g., "12px"), em units (e.g., "1.2em"), percentages (%), or other relative values.

Example: font-size: 16px;

Property background-color

The background-color property is used to format the background color of an element.

The value can also be a color name, a hexadecimal code, or an "rgb()" function to specify the color.

Example: background-color: #F0F0F0;

Property font-family

The "font-family" property defines the font used for the text within an element.

The value can be a font name (e.g., Arial, Helvetica) or a prioritized list of font names.

Example: font-family: Arial, sans-serif;

Property text-align

The "text-align" property is used to align the text inside an element.

The value can be left, right, center, or justify (to justify text on both ends).

Example: text-align: center;

Property width

The "width" property specifies the width of an element.

The value can be in pixels, percentages (%), or auto for automatic width.

Example: width: 300px;

Property height

The height property specifies the height of an element.

The value can be in pixel, percentages (%), or auto for automatic height.

Example: height: 200px;

Property border

The border property is used to create a border around an element.

The value can include border thickness (e.g., "1px"), border style (e.g., solid, dotted), and color (e.g., red).

Example: border: 1px solid black;

Property margin

The margin property defines the spacing between an element and surrounding elements.

The value can be a pixel value (e.g., "10px"), pixel values for each direction (e.g., "5px 10px"), or auto for automatic spacing.

Example: margin: 10px;

Property padding

The padding property defines the spacing between the content and the border of an element.

The value can be a pixel value or pixel values for each direction.

Example: padding: 20px;

 

These are just a few examples of CSS properties and their values. CSS provides many other properties to style and customize elements on your webpage. You can explore more properties and customize them to achieve various designs and effects for your website.