Common CSS Properties
CSS (Cascading Style Sheets) is a style sheet language used to describe the presentation of a document written in a markup language like HTML. CSS properties are the building blocks that allow you to control the appearance and layout of web pages. Here are some of the most common CSS properties:
1. Typography Properties
font-family
: Specifies the font family for the selected text.font-size
: Sets the size of the font.font-weight
: Specifies the weight (or boldness) of the font.font-style
: Specifies the style of the font (normal, italic, or oblique).text-align
: Aligns the text within its containing element.text-decoration
: Adds or removes decorations from the text.line-height
: Sets the height of a line of text.letter-spacing
: Adjusts the spacing between characters in a text.word-spacing
: Adjusts the spacing between words in a text.
2. Color Properties
color
: Sets the color of the text.background-color
: Sets the background color of an element.opacity
: Sets the opacity level for an element.
3. Box Model Properties
width
: Sets the width of an element.height
: Sets the height of an element.margin
: Sets the margin area on all four sides of an element.padding
: Sets the padding area on all four sides of an element.border
: Sets the style, width, and color of an element's border.
4. Layout Properties
display
: Specifies the display behavior of an element.position
: Specifies the type of positioning method used for an element.float
: Specifies whether an element should float to the left, right, or not at all.clear
: Specifies which sides of an element other floating elements are not allowed.z-index
: Sets the stack order of an element.
5. Responsive Design Properties
media queries
: Applies different styles based on the characteristics of the device, such as screen size.viewport
: Defines the viewport of the web page, which is the area of the web page that the user can see.
6. Miscellaneous Properties
list-style
: Sets the type, position, and image of a list-item marker.cursor
: Specifies the type of cursor to be displayed when pointing over an element.box-shadow
: Adds one or more drop shadows to the box around the element.transition
: Specifies the transition between two states of an element.transform
: Applies a 2D or 3D transformation to an element.
Here's a Mermaid diagram that visualizes the core CSS properties:
graph TD
A[CSS Properties]
B[Typography]
C[Color]
D[Box Model]
E[Layout]
F[Responsive Design]
G[Miscellaneous]
A --> B
A --> C
A --> D
A --> E
A --> F
A --> G
B --> font-family
B --> font-size
B --> font-weight
B --> font-style
B --> text-align
B --> text-decoration
B --> line-height
B --> letter-spacing
B --> word-spacing
C --> color
C --> background-color
C --> opacity
D --> width
D --> height
D --> margin
D --> padding
D --> border
E --> display
E --> position
E --> float
E --> clear
E --> z-index
F --> media-queries
F --> viewport
G --> list-style
G --> cursor
G --> box-shadow
G --> transition
G --> transform
This diagram provides a high-level overview of the most common CSS properties and how they are grouped into different categories. By understanding these core properties, you can effectively style and layout your web pages to achieve the desired visual appearance.