Menu Container Style
To arrange the menu list horizontally, set display: flex;.
.navbar .nav-menu { display: flex; align-items: center; background: white; }
display: flex; is used to arrange the elements horizontally.
align-items: center; is used to vertically center-align the elements.
With this setup, the menu list will be arranged horizontally and vertically centered.
Menu Item Style
.navbar .nav-link { margin: 0 16px; font-size: 14px; font-weight: var(--weight-semibold); }
Set margin: 0 16px; to space out the menu items.
margin: 0 16px; sets the top and bottom margins to 0 and the left and right margins to 16px.
The margin property can set values in the order of top, right, bottom, and left.
For example, margin: 2px 4px 6px 8px; sets margins for the top, right, bottom, and left in that order.
If this is confusing, you can also use the individual properties margin-top, margin-bottom, margin-left, margin-right.
Set the font size for the menu items with font-size: 14px;.
font-weight: var(--weight-semibold); sets the font weight.
var(--weight-semibold); uses a variable named --weight-semibold, which references a predefined font-weight value.
Lessons in this chapter Β· Creating Navigation
- 1. What is a Container?
- 2. What is Navigation?
- 3. Styling the Navigation Bar
- 4. Styling Navigation div
- 5. Create a Logo
- 6. Difference Between span and p Tags
- 7. Creating a Menu
- 8. Configuring Menu Items
- 9. Styling the Menu
- 10. Creating a Button
- 11. Styling Buttons
- 12. Common Button Style
- 13. primary, secondary button styles
- 14. How to Style Buttons and Add Icons in Menus
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help