-
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)
Responsive Flexbox means using Flexbox properties in combination with media queries to make layouts adapt to different screen sizes — like mobile, tablet, and desktop.
Flexbox is naturally responsive because it automatically adjusts item sizes and spacing. You can use flex-wrap
, flex-direction
, gap
, and media queries to build layouts that work beautifully on all devices.
Property | Description |
---|---|
flex-wrap |
Allows items to wrap on smaller screens |
flex-direction |
Can switch from row to column on smaller screens |
flex |
Allows dynamic resizing of items |
gap |
Adds spacing between items without using margins |
media queries |
Customize layout per screen size |
<div class="flex-container">
<div class="box">Box 1</div>
<div class="box">Box 2</div>
<div class="box">Box 3</div>
</div>
.flex-container {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.box {
flex: 1 1 200px;
background: #eee;
padding: 20px;
text-align: center;
}
This layout will automatically wrap boxes when screen width is limited.
@media (max-width: 600px) {
.flex-container {
flex-direction: column;
}
}
This changes the layout from row to column on smaller screens.
<nav class="navbar">
<div class="logo">Logo</div>
<div class="links">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Contact</a>
</div>
</nav>
.navbar {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
padding: 10px;
}
.links a {
margin-left: 15px;
}
@media (max-width: 500px) {
.navbar {
flex-direction: column;
align-items: center;
}
.links a {
margin: 5px;
}
}
✅ Write CSS for the following:
Q1. Create a flex container that wraps items on small screens.
Q2. Build a 3-column layout that becomes single-column on mobile.
Q3. Make flex items fill the width equally.
Q4. Add a gap between flex items.
Q5. Center items horizontally and vertically on all screens.
Q6. Change layout from row
to column
below 768px.
Q7. Make a responsive button group with Flexbox.
Q8. Adjust item sizes using flex-basis
and flex-grow
.
Q9. Create a sidebar that becomes top-bar on small screens.
Q10. Create a flex image gallery that stacks images on mobile.
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)