Friday, January 16, 2026

CSS Syntax

 

Selectors in CSS

Selectors define which HTML elements are styled. CSS offers several types of selectors.

1. Universal Selector: Applies styles to all elements.

* {
    margin: 0;
    padding: 0;
} 

2. Type Selector: Targets specific HTML elements.

h1 {
    font-family: Arial, sans-serif;
}

3. Class Selector: Styles elements with a specific class attribute.

.box {
    border: 1px solid black;
    padding: 10px;
}

4. ID Selector: Targets a single element with a specific ID.

#header {
    background-color: lightgray;
}

No comments:

Post a Comment

What are 'Piecewise Functions'?

 A single function that uses different equations depending on the input , like f(x) = x for x < 0 and f(x) = x^2 for x >0. Such func...