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

Python Dictionary

  Removing Dictionary Items Dictionary items can be removed using built-in deletion methods that work on keys: del :  removes an item using ...