-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
CSS Basics
CSS Styling Properties
CSS Box Model
CSS Margin
CSS Padding
CSS Borders
CSS Outline
CSS Height/Width
CSS Max-width
CSS Display
CSS Position
CSS Z-index
CSS Overflow
CSS Float
CSS Inline-block
CSS Align
CSS Box Sizing
CSS Text
CSS Fonts
CSS Icons
CSS Text Effects
CSS Web Fonts
CSS Colors
CSS Backgrounds
CSS Color Keywords
CSS Gradients
CSS Shadows
CSS Links
CSS Lists
CSS Tables
CSS Advanced Selectors & Features
CSS Combinators
CSS Pseudo-classes
CSS Pseudo-elements
CSS Attribute Selectors
CSS Specificity
CSS !important
CSS Units
CSS Variables
CSS @property
CSS Math Functions
CSS Media and Image Styling
CSS Image Styling
CSS Image Centering
CSS Image Filters
CSS Image Shapes
CSS object-fit
CSS object-position
CSS Masking
CSS Layout Techniques
CSS Website Layout
CSS Navigation Bar
CSS Dropdowns
CSS Image Gallery
CSS Counters
CSS Pagination
CSS Multiple Columns
CSS User Interface
CSS Flexbox
CSS Grid
CSS Responsive Design (RWD)
CSS Selectors are used to target HTML elements you want to style.
They tell the browser which elements the CSS rule applies to.
Selector | Description | Example |
---|---|---|
* |
Universal selector – targets all elements | * {margin: 0;} |
element |
Targets all elements of a type | p {color: red;} |
.class |
Targets all elements with a specific class | .note {font-size: 16px;} |
#id |
Targets a specific element by ID | #header {color: blue;} |
element1, element2 |
Targets multiple elements | h1, p {margin: 10px;} |
Use a comma ,
to apply the same style to multiple elements.
h1, h2, p {
color: navy;
}
.classname
)<p class="intro">This is a paragraph.</p>
.intro {
color: green;
}
#idname
)<h1 id="main-title">Welcome</h1>
#main-title {
font-size: 24px;
}
*
)* {
box-sizing: border-box;
}
h1, h2, p {
font-family: Arial;
}
Q1. Target all <p>
elements and change their font size to 16px.
Q2. Style all <h1>
and <h2>
elements to have blue text color using a group selector.
Q3. Create a class .highlight
and apply a yellow background color.
Q4. Write a rule to target an element with ID #banner
and make its text bold.
Q5. Use the universal selector to remove all margins.
Q6. Create a .button
class that changes text color to white.
Q7. Write a CSS rule to apply a font family of Arial to all <div>
elements.
Q8. Combine a group selector to style <ul>
and <ol>
with the same padding.
Q9. Write a class .card
to set the border to 1px solid gray.
Q10. Write a rule that applies the same font size to <h1>
, <h2>
, and <p>
elements.
CSS Basics
CSS Styling Properties
CSS Box Model
CSS Margin
CSS Padding
CSS Borders
CSS Outline
CSS Height/Width
CSS Max-width
CSS Display
CSS Position
CSS Z-index
CSS Overflow
CSS Float
CSS Inline-block
CSS Align
CSS Box Sizing
CSS Text
CSS Fonts
CSS Icons
CSS Text Effects
CSS Web Fonts
CSS Colors
CSS Backgrounds
CSS Color Keywords
CSS Gradients
CSS Shadows
CSS Links
CSS Lists
CSS Tables
CSS Advanced Selectors & Features
CSS Combinators
CSS Pseudo-classes
CSS Pseudo-elements
CSS Attribute Selectors
CSS Specificity
CSS !important
CSS Units
CSS Variables
CSS @property
CSS Math Functions
CSS Media and Image Styling
CSS Image Styling
CSS Image Centering
CSS Image Filters
CSS Image Shapes
CSS object-fit
CSS object-position
CSS Masking
CSS Layout Techniques
CSS Website Layout
CSS Navigation Bar
CSS Dropdowns
CSS Image Gallery
CSS Counters
CSS Pagination
CSS Multiple Columns
CSS User Interface
CSS Flexbox
CSS Grid
CSS Responsive Design (RWD)