Lecture
Styling Buttons in Menus
Let's learn how to style buttons in menus and add icons.
Button Style in Menu
.navbar .btn { margin-right: 24px; }
margin-right: 24px;: Sets the right margin to 24px.
Icon Style in Menu Button
.fas.fa-arrow-right { margin-left: 8px; font-size: 14px; }
margin-left: 8px;: Sets the left margin to 8px, providing a natural spacing for the arrow icon within the button.font-size: 14px;: Sets the font size of the icon to 14px.
How to Add Icons
There are several ways to add icons.
Besides drawing them yourself or using images, you can also utilize icon libraries like fontawesome.
Importing fontawesome Library
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" integrity="sha384-DyZ88mC6Up2uqS4h/KRgHuoeGwBcD4Ng9SiP4dIRy0EXTlnuz47vAwmeGwVChigm" crossorigin="anonymous" />
To use icons, include the fontawesome library's CSS file via the <link> tag.
Using fontawesome Library
<i class="fas fa-arrow-right"></i>
With the fontawesome library, you can easily add icons by specifying the icon's name in the class attribute, such as fas fa-arrow-right.
Additionally, you can explore various icons on fontawesome's official website and use them in your project.
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