-
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)
There are three ways to insert CSS into an HTML document:
CSS is added directly to an HTML element using the style
attribute.
<p style="color: red;">This is a paragraph.</p>
✅ Used for quick, one-off styling.
CSS is written inside a <style>
tag within the <head>
section of the HTML document.
<!DOCTYPE html>
<html>
<head>
<style>
p {
color: blue;
}
</style>
</head>
<body>
<p>This is styled using internal CSS.</p>
</body>
</html>
✅ Used when styling a single HTML page.
CSS is written in a separate .css
file and linked to the HTML using the <link>
tag.
style.css
p {
color: green;
}
index.html
<head>
<link rel="stylesheet" href="style.css">
</head>
✅ Best practice for styling multiple web pages.
CSS files must end with the .css
extension.
Q1. Use inline CSS to make a paragraph's text green.
Q2. Use internal CSS to change all <h1>
text to blue.
Q3. Use external CSS to change the background color of the page to lightgray.
Q4. Write HTML code to link an external CSS file named main.css
.
Q5. Use internal CSS to change all <div>
elements to have 20px padding.
Q6. Write inline CSS to set the font size of a paragraph to 18px.
Q7. Use internal CSS to center-align all <h2>
headings.
Q8. Use external CSS to make all links have no underline.
Q9. Use internal CSS to set a black border around all images.
Q10. Write the HTML and CSS to apply Arial font to all <body>
text using external CSS.
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)