"Create a dynamic and user-friendly responsive navbar using Bootstrap with toggle

I need assistance with creating a new project template to convert a WordPress template into a Bootstrap template.

Currently, I am working on the navbar and facing issues with responsive design and toggle navigation. On laptop devices, the navbar looks good as intended. However, on smartphone devices, especially with navbar-left and navbar-right, the toggle-navigation does not display the navbar properly.

Laptop device :

https://i.stack.imgur.com/thjBd.png

Smartphone device :

https://i.stack.imgur.com/vcb32.png

I want all elements to be vertically aligned in the smartphone view, but that's not the case for www.coe.int and languages with glyphicons.

This is my HTML script:

<nav class="navbar navbar-default navbar-static-top">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <!-- Collection of nav links and other content for toggling -->
        <div id="navbarCollapse" class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-left">
                  <li><a id="coe" href="http://www.coe.int">WWW.COE.INT</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-middle">
                <li><a class="active" href="#">EUROPEAN PHARMACOPOEIA</a></li>
                <li><a href="#">PHARMEUROPA</a></li>
                <li><a href="#">OTHER PUBLICATIONS</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">Languages</a></li>
                <li><a><span class="glyphicon glyphicon-search"></span></a></li>
            </ul>
        </div>
    </div>
</nav>

And this is my CSS section:

body {
    font-family:sans-serif;
    font-size: 1.25em;
}

/* ######################## */
/*        HEADER PART       */
/* ######################## */

header{
    background-color:  #e8e8e8;
}

header a{
    color:  #a5a5a4;
}

/* Bootstrap Stuff */

nav.navbar.navbar-default.navbar-static-top {
    background-color: #e8e8e8;
}

.navbar .navbar-nav {
  display: inline-block;
  float: none;
  vertical-align: top;
}

.navbar .navbar-collapse {
  text-align: center;
}

a#coe {
    font-weight: bold;
    text-decoration: none;
}

ul.nav.navbar-nav.navbar-middle > li > a:hover {
    background-color: #1b7eac;
    color: black;
    transition: all 0.2s;
       }


ul.nav.navbar-nav.navbar-middle > li > a:focus{
    background-color: #1b7eac;
    color: white;
    transition: all 0.2s;
       }

Any suggestions or solutions would be greatly appreciated.

Answer №1

Unfortunately, I am unable to provide feedback due to my reputation restrictions, but have you considered adjusting the text size using media queries for the desired outcome?

--UPDATE--

If your toggle button is already working, you can vertically align them by utilizing the bootstrap operator:

col-sm-4 (for three items aligned vertically)

col-sm-3 (for four items aligned vertically)

This will allow each element to have its own space and align them in a vertical position.

Just make sure you have a container, followed by a row, and then implement this property, like so:

<div class="container">
    <div class="row">
        <div class="col-sm-4">item goes here</div>
        <div class="col-sm-4">item goes here</div>
        <div class="col-sm-4">item goes here</div>
    </div>
</div>

I trust this information will be beneficial to you!

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

Using jQuery and Modernizr for CSS3 and Javascript transitions support in Internet Explorer

Looking for a way to add support for button hover effects in IE 7-9 on this Codepen.io project. Can anyone help? For example, I'm trying: transition-duration: 0.5s; transition-property: all; transition-timing-function: ease; margin-top: 5px; I atte ...

Tips for changing between two texts within a button when clicked

Seeking a solution for toggling between two different texts inside a button when making an ajax call, with only one text displayed at a time. I'm facing difficulty in targeting the spans within the button specifically. Using 'this' as conte ...

Ensuring Input Accuracy with jQuery Form Validation

I have implemented a form validation code that is currently functioning correctly. Below is the snippet of the code I used: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script> <script ...

Ensure that the child div remains at the bottom of the parent div

I'm trying to make sure that the subfooter div stays at the bottom of the childbox div like a footer. You can see the code on this jsfiddle link <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8> <title ...

Navigating through parent folder HTML files from child folder HTML files

Seeking guidance as I embark on a new project! Check out this link to see my skills in action: collegewebsite.zip Now for the query at hand. I am working on a project named Coffee Cafe for my tuition assignment. It involves utilizing CSS and HTML with J ...

How to specify columns when storing data in a CSV file using Scrapy

As I scrape data from the web, I am facing an issue with my csv file where the links column is always displayed as the first column. How can I specify the placement of columns in the csv file? pName = response.css('#search .a-size-medium') ...

Tips for utilizing CSS container queries in conjunction with the Material-UI framework

I'm looking to implement CSS container queries with MUI. In my code, I want to change the background color to red if the parent width is less than 300px. Check out the sandbox const StyledItem = styled("div")(({ theme }) => ({ border: ...

Bootstrap form validation issues

Currently, I am utilizing Vue.js along with Bootstrap for the creation of a website. In this process, I have set up a form on which I am implementing my custom validation logic. Everything seems to be functioning correctly until the moment when the user hi ...

Issue with jQuery where it returns "undefined" when trying to access the CSS display property

On my page, there are several divs with default display styles set in an external .css file. When a certain condition is met, I use jQuery to turn one on and the others off using the fadeIn() and fadeOut() methods. However, I've noticed that in Firef ...

Showing the total quantity of products, reminiscent of a virtual shopping basket

I am trying to show a number similar to how a shopping cart displays items. The php code I was given currently shows a cookie value, which is mostly functional. However, if you encounter errors while adding items to the cart, it increases the cookie count ...

How can CSS be utilized to style the visited links that are hovered over

Is there a way to change the font color specifically for visited hyperlinks that are being hovered over by the mouse? I am trying to achieve this: a:visited:hover {color: red} ...

The close button on the modal vanishes on a real iPhone

The issue I am facing is that the Close Button appears when testing responsiveness in Chrome, but disappears on a real iPhone. When clicking on an image, the image gallery should appear. However, on an iPhone, only the previous and next buttons are visibl ...

Is it necessary to include the 'html' and 'body' tags in a WordPress Page Template?

Currently, I'm in the process of creating a unique Page Template for my WordPress website. In the file named newpagetemplate.php, I have included only this code: <html> <body> <?php /* Template Name: CustomPage */ ?> <div> ...

JavaScript: a single function and two calls to Document.getElementById() results in both returning "undefined"

Within my JavaScript file, I have a function that utilizes two variables: choice and courseChosen. The latter variable must be converted into an object first. In the HTML, the tags courseName and courseInfo are used for choice and courseChosen respectively ...

I am having trouble compiling sass in VS Code using the sass --watch command

I've encountered an issue while trying to compile sass through the terminal. Despite having already installed node.js and successfully using Live Sass, I consistently receive the following error message: sass : The term 'sass' is not recogni ...

Customizing the COREui Admin Template to replicate the demo's design

Currently, I am delving into the world of web development and experimenting with integrating the COREui 4.0.1 Bootstrap admin template within an existing Symfony 5.3 project instead of utilizing standard Bootstrap 5 components and utilities. My goal is to ...

Discover the complete compilation of CSS class regulations (derived from various stylesheets) along with their currently active properties for the chosen element

Is there a way to retrieve all the matched CSS Selectors for a selected element and access the properties of each active class applied to that element? I have researched methods like using getMatchedCSSRules and checking out However, I am hesitant to use ...

Tips for creating a clickable A href link in the menu bar that triggers an accordion to open in the body when clicked - html

Is there a way to open the first accordion when clicking on the "open 1st accordion" link, and do the same for the second link? The accordions themselves work perfectly fine, I just need a way to trigger them from outside their scope by clicking on links i ...

Inline checkbox label with Bootstrap 5 styling

How can I align the checkbox with its label? Example <div class="row g-1 border-bottom p-3"> <div class="col border-end justify-content-center d-flex align-items-center"> <div class="h6 text-sm-center h-25&quo ...

Tips for customizing the color of pagination in bootstrap

I'm currently in the process of designing a website and I've chosen to implement Bootstrap's pagination for navigating between pages. Due to time constraints, I was wondering if anyone knows how I can utilize classes like "bg-dark", "bg-prim ...