-
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)
A navigation bar (nav bar) is a section of a website that contains links to other parts of the site. It is commonly placed at the top or side of a webpage and styled using CSS to enhance usability and appearance.
Horizontal Navbar – Usually at the top of the page
Vertical Navbar – Typically used for side navigation
Fixed Navbar – Stays in place during scroll
Responsive Navbar – Adjusts layout on different screen sizes
<nav>
<ul class="navbar">
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
.navbar {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #333;
overflow: hidden;
display: flex;
}
.navbar li a {
display: block;
color: white;
text-align: center;
padding: 14px 20px;
text-decoration: none;
}
.navbar li a:hover {
background-color: #111;
}
.navbar {
display: flex;
flex-direction: column;
width: 200px;
}
.fixed-navbar {
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
@media screen and (max-width: 600px) {
.navbar {
flex-direction: column;
}
}
Q1. Create a horizontal navigation bar with four links.
Q2. Style the nav bar with a dark background and white text.
Q3. Add hover effects to change link background color.
Q4. Make the navigation bar fixed at the top.
Q5. Create a vertical sidebar navigation bar.
Q6. Use Flexbox to align links horizontally.
Q7. Center the navigation links in the nav bar.
Q8. Add padding and spacing between links.
Q9. Make a responsive navigation bar using media queries.
Q10. Highlight the active link in a different color.
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)