Navigating a website can be frustrating when important links, such as social media icons, disappear when the navbar collapses on smaller screens. Fortunately, Bootstrap 4 offers an elegant solution to keep certain navbar items visible even when the menu is collapsed.
The issue arises when the navbar is set to collapse when the screen width becomes narrow. This behavior is controlled by the .collapse class. By default, all elements within the .collapse container are hidden when the collapse is activated.
To keep certain navbar items from disappearing with the collapse, simply move them outside the .collapse container. This can be achieved using the order-* utility classes to adjust the flexbox order of the elements.
In this example, the social media icons are placed within a container outside the .collapse element. The d-flex and order-* classes ensure that the icons remain in the correct order and position when the navbar is collapsed.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3