How can I maintain my bottom navigation bar in Bootstrap 3 without using a 3 span icon?

Hey everyone, I'm still getting the hang of MVC as I only started using it around 3 weeks ago.

Currently, I am working on a Web Application where I am trying to implement a specific feature:

At the bottom of the page, I have a navbar with some Html.ActionLink's, each one having its own glyphicon and text. What I aim to achieve is when the window size is reduced to a certain point, instead of the usual button with 3 span icons that expand the navbar, I want the same navbar to remain visible but only display the icons without any text.

Here's the code snippet I have for this section:

<div class="navbar navbar-inverse navbar-fixed-bottom">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            @Html.ActionLink("Home", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
        </div>
        <div class="navbar-collapse collapse" aria-label="Right-Align">
            <ul class="nav navbar-nav">
                <li>@Html.ActionLink("Status", "Edit/4", "Estado_Motoristas", new { area = "" }, new { @class = "glyphicon glyphicon-random" })</li>
                <li>@Html.ActionLink("Search", "Index", "Pracas", new { area = "" }, new { @class = "glyphicon glyphicon-search" })</li>
                <li>@Html.ActionLink("GPS", "Index", "GPS", new { area = "" }, new { @class = "glyphicon glyphicon-road" })</li>
                <li>@Html.ActionLink("Form", "Index", "Home", new { area = "" }, new { @class = "glyphicon glyphicon-file" })</li>
                <li>@Html.ActionLink("Messages", "Index", "Home", new { area = "" }, new { @class = "glyphicon glyphicon-envelope" })</li>
                <li>@Html.ActionLink("Settings", "Index", "Manage", new { area = "" }, new { @class = "glyphicon glyphicon-cog" })</li>
            </ul>
        </div>
    </div>
</div>

Any suggestions on how I can solve this issue? Appreciate any help in advance!

Answer №1

First off, I made some changes to your code structure. I eliminated the class="navbar-collapse collapse" from the second div to prevent the menu from collapsing into the button. Next, I repositioned the glyphicons within a span class and wrapped each ActionLink inside these spans. The class of the ActionLink was modified to hidden-xs, ensuring that only icons are displayed when the screen is reduced, and both text and icons appear in full-size screens. For further information, check out this responsive-utilities link.

<div class="navbar navbar-inverse navbar-fixed-bottom">
<div class="container">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        @Html.ActionLink("Início", "Index", "Home", new { area = "" })&nbsp;&nbsp;&nbsp;&nbsp;
    </div>
    <div>
        <ul class="nav navbar-nav">
            <li><span class="glyphicon glyphicon-random"></span><span>@Html.ActionLink(" Estado", "Edit/4", "Estado_Motoristas", new { area = "" }, new { @class = "hidden-xs" })&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
            <li><span class="glyphicon glyphicon-search"></span><span>@Html.ActionLink(" Pesquisa", "Index", "Pracas", new { area = "" }, new { @class = "hidden-xs" })</span>&nbsp;&nbsp;&nbsp;&nbsp;</li>
            <li><span class="glyphicon glyphicon-road"></span><span>@Html.ActionLink(" GPS", "Index", "GPS", new { area = "" }, new { @class = "hidden-xs" })</span>&nbsp;&nbsp;&nbsp;&nbsp;</li>
            <li><span class="glyphicon glyphicon-file"></span><span>@Html.ActionLink(" Formulário", "Index", "Home", new { area = "" }, new { @class = "hidden-xs" })</span>&nbsp;&nbsp;&nbsp;&nbsp;</li>
            <li><span class="glyphicon glyphicon-envelope"></span><span>@Html.ActionLink(" Mensagens", "Index", "Home", new { area = "" }, new { @class = "hidden-xs" })</span>&nbsp;&nbsp;&nbsp;&nbsp;</li>
            <li><span class="glyphicon glyphicon-cog"></span><span>@Html.ActionLink(" Definições", "Index", "Manage", new { area = "" }, new { @class = "hidden-xs" })</span></li>
        </ul>
    </div>
</div>

https://i.sstatic.net/yncCf.png

Answer №2

Consider implementing this to enhance your HTML structure:

<div class="menu-toggle" data-target="#menu" data-toggle="collapse">
<a href="/" class="logo">MyBrand</a>
</div>

Also, don't forget to add the following styling:

.menu-toggle {
background-color: #f8f8f8;
border: none;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Display the overlay solely when the dropdown is visible

My code works, but the 'overlay active' class only functions properly when I click on the button. If I click outside of the button, it doesn't work as intended. I want the 'overlay active' class to be displayed only when the dropd ...

Issue encountered when attempting to include jquery.min.js due to a jquery conflict

I've been experimenting with the jquery.scrollableFixedHeaderTable.js extension in order to create a table header that remains fixed as you scroll through the table. However, when I attempt to incorporate jquery.min.js for a tooltip plugin, the scrol ...

Use the accelerometer in JavaScript and Cordova to control the movement of an object, such as a ball

Having trouble figuring out how to move a ball using the accelerometer. Any tips on combining the accelerometer values with the ball movement? Waiting for accelerometer... <div id="heading">Waiting for heading...</div> <div id="ball" ...

Displaying content on a click event in AngularJS

I am facing an issue with the ng-show directive not working as expected when a user clicks on an icon. The desired behavior is that the parent div should initially display content, but when the play icon is clicked, the contents of the div should become ...

Adding an HTML tag attribute to a Bootstrap 5 popover using the setAttribute() method: A Step-by

Trying to include HTML tags in a popover setAttribute() function within Bootstrap 5, but the tags are displayed as content rather than being applied as attributes. <button type="button" class="btn btn-secondary mx-2" data-bs-containe ...

What could be the reason for reverse geocoding failure following the marker's movement when autocomplete event is triggered in Google Maps?

When I initiate the map and move the pin, the reverse geocoding correctly updates the input with the new address. However, if I manually type in an address using autocomplete and then drag the marker, the reverse geocoding stops functioning: var map; ...

MySQL long polling technique in PHP

I stumbled upon a script that utilizes PHP long polling. It uses the code below to detect changes in a text file and returns its contents to the browser. Is there a way to modify this script so it can check a table for new events instead? $filename = dir ...

What is the best method to implement: should I opt for bind or live, or is there a different approach

Within my form, the button is coded like this: <button id="mybutton" type="submit"></button> I am using jQuery to submit the form when the button is clicked: $('#mybutton').click(function() { $('form#myform') ...

Discover the steps to incorporate a glowing effect into your custom progress bar using JavaFX

After successfully creating a custom progress Bar in JavaFX, my next step is to incorporate a glow effect into the progressBar. To achieve this, I have constructed an ellipse with a Gaussian blur effect and integrated the centerX of the ellipse into a tim ...

Is there a way to adjust the transparency of an image without affecting any overlaid text while using Bootstrap's carousel feature?

I am currently working with Bootstrap v4 to build a carousel featuring an image with caption text. My goal is to have the image faded while leaving the text unaffected. Despite trying several non-Bootstrap solutions, I have been unsuccessful in achieving t ...

Personalized dropdown appearance

During my work on a select box, I discovered that custom styling is not possible. I attempted to use some plugins but did not find one that met my needs. I am seeking a dropdown menu with options in both black and gray, similar to this template but using ...

Is a Responsive Split Layout the Solution for Your Web Design Needs?

I'm looking to create a webpage layout where the left half of the viewport is for Login and the right half is for Signup. This layout should be split side by side on tablets, desktops, and large screens, but stacked vertically (Login on top, Signup on ...

Guide to creating a fixed sidebar, right column, header, and footer with scrollable content utilizing flexbox styling

My goal is to create a webpage layout with a fixed header, footer, sidebar, and right column containing ads, while allowing the content to be scrollable. I attempted to achieve this by placing the header and footer outside of the flexbox, and using a wrapp ...

Determining the number of words in every line within a textarea

I am looking to determine the number of words per line in a textarea. The width of the textarea is variable. Check out this code snippet that calculates the number of rows: http://jsfiddle.net/2tcygj9e/ ...

What is the most effective method for determining the distance between two UK Postcodes?

Can you suggest a reliable method for calculating the distance between two UK postcodes in order to determine if they are within range? I do not intend to display a map, but instead provide a list of results for valid locations. For example, showing loca ...

Form aligned to the right

Is there a way to align the form to the right in this code? HTML @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@500&display=swap'); * { font-family: "Noto Sans", sans-serif; font-weight: 500; } .no-outline { ...

Real-time Updating of ChartJS Charts in Rails Using AJAX

I am currently working with Rails 5 and the latest version of ChartJS library (http://www.chartjs.org/docs/). My goal is to retrieve the most recent 20 items from the SensorReading model and update the Chart using setInterval and AJAX. I have successfull ...

What are some strategies for optimizing speed and efficiency when utilizing jQuery hover?

While developing a web application, I have created a grid using multiple div elements that are X by Y in size, determined by user input. My goal is to change the background color of surrounding divs within a certain distance when hovering over one particul ...

The stacking order of React components

I am having an issue with the Z-index in my component-based React app. I currently have a list component that contains items, and I want to adjust the CSS scale and z-index to display one item in front of the others. The problem arises when the hovered it ...

Displaying inline causes the block elements to be removed from the

After two months of learning HTML and CSS, I still feel like a beginner. I'm attempting to create a header navigation bar, but whenever I apply the display: inline property, everything vanishes. I know this issue is probably basic, but any advice woul ...