Currently, I am attempting to move certain elements to the right within the navigation bar by utilizing Twitter Bootstrap 4

I am struggling to move the login and cart sections to the right side of the page. I have attempted using classes such as mr-auto, ml-auto, justify-content-between, and justify-content-end, but unfortunately, none of them seem to work. What other options can I explore to correct this alignment issue?

#header-nav
{
    background-color: #C5B358;
    border-radius: 0;
    border: 0;
}
<nav id=header-nav class="navbar navbar-expand-md navbar-default justify-content-end">
      <a href="index.html" class="navbar-brand">
        <h1 class="tagline">Subha</h1>
      </a>
      <div class="collapse navbar-collapse">
        <ul class="navbar-nav">
        <li class="nav-item">
          <a href="#" class="nav-link">Cart</a></li>
        <li class="nav-item">
          <a href="#" class="nav-link">Login</a></li>
      </ul>
      </div>
    </nav> 

View the navigation bar in my project here.

Answer №1

Utilize the ml-auto class to align the login and cart elements to the right side.

<ul class="navbar-nav ml-auto">

Omit the justify-content-end class.

<nav id=header-nav class="navbar navbar-expand-md navbar-default">

#header-nav {
  background-color: #C5B358;
  border-radius: 0;
  border: 0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="deaeb1aeaebbacf0b4ad9eeff0efe8f0ee">[email protected]</a>/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>

<nav id=header-nav class="navbar navbar-expand-md navbar-default">
  <a href="index.html" class="navbar-brand ">
    <h1 class="tagline">Subha</h1>
  </a>
  <div class="collapse navbar-collapse ">
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a href="#" class="nav-link">Cart</a></li>
      <li class="nav-item">
        <a href="#" class="nav-link">Login</a></li>
    </ul>
  </div>
</nav>

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

Having trouble retrieving text using getText() or getAttribute("innerHTML")

getAttribute but struggling to retrieve the text associated with each combobox. I need to access the text content of every combobox. <small> <input type="checkbox" checked="checked" value="on" name="irOperations[0]"/> Account Activity < ...

Storing query for later utilization using form and javascript

I have implemented a function to create charts using the following code snippet: $('#button_submit').click(function() { var start_date = $('#start_date').val(); var end_date = $('#end_date').val(); var type = $( ...

Randomly choose one of 5 pages and insert an HTML element at different intervals using JavaScript, jQuery, MySQL, or PHP

Suppose we have the following HTML element: <img src="icon.png"> Our website consists of 5 pages: index.php products.php register.php about.php terms.php How can we randomly place this HTML element on one of the pages, ensuring it stays there for ...

Looking to extract a specific field using Angular JS?

The JSON data I need is fetched from the link provided below: http://maps.googleapis.com/maps/api/geocode/json?address=SFO When retrieving the JSON, only the parameter example ?adress=sfo should be used. This will result in fetching all values associated ...

Attempting to insert the symbol "$gt" into a query for a search. {[CastError: Unable to convert value "[object Object]" to date at path "createdAt"]}

In the following code snippet: Reviews.find({createdAt : {"$lt" : app.locals.lastDate}}), I am trying to dynamically change the $lt to $gt. app.post("/scroll", function(req, res){ console.log("req.body...", req.body); var sortCreate = req.body.old ...

Route Handler 13 is encountering difficulties in retrieving data from the body in the (app/api/auth) endpoint

Whenever I attempt to retrieve the body from the new export async function POST( req: Request), it seems to come through as a stream instead of the expected content type. The route handler can be found in api/auth/signup See folder layout image export asyn ...

The process of compressing videos and image files is done automatically in a React production build

I've recently finished building a react application and have deployed it with the production build. yarn run build serve -S build While I know it compresses the .js and .scss files, creating a build folder to serve from, I'm wondering if it also ...

Activate the sliding toggle feature on click for all div elements

Whenever a specific li element is clicked, I aim to open its corresponding div element. This is the code snippet I currently have: <ul class="no-padding pro-list"> <li><a href="#" class="pro-1 pro">A</a> <div class= ...

Get rid of the horizontal scroll bar and expand the width of the table

Normally, Tabulator limits the maximum width of the table and adds a horizontal scroll bar at the bottom. Is there a way to eliminate this scroll bar and make Tabulator expand the width of the table instead (resulting in the horizontal scrollbar appearin ...

Manage an automated script that populates an input field

I am currently working on a script that checks whether the value of a variable matches the value of a hidden input, and then returns a confirmation message. The variable can be manually entered or automatically filled by another script. When the variable ...

Manipulating data in a deeply nested field of an embedded document using Mongoose, MongoDB, and Express

I have been pondering whether it is feasible to input data into the comments field of my "TopicSchema": var mongoose = require('mongoose'); var TopicSchema = new mongoose.Schema({ username: String, topic: String, des ...

Should one consider utilizing Ionic for creating a mobile web variant of a website?

Working for a Startup, we made the decision to create an adaptive website instead of a responsive one. This means that we serve different views for different devices in order to provide the best user experience for both mobile and desktop users. We are c ...

Spacing of input fields in Chrome on iOS with Bootstrap 4

I've encountered an issue that has me stumped. I have a basic form with four text input fields, and while the spacing looks perfect on all browsers, Chrome on IOS is giving me trouble. The spacing between the input fields seems to be disregarded. My ...

What is the best way to retrieve the argument type of an SFC component's event?

Imagine I have a situation where there is an SFC component containing a save emit: // ChildComponent.vue const emit = defineEmits<{ save: [data: { new: Row[]; removed: Row[] }]; }>(); If I needed to access the new and removed properties in a paren ...

Displaying geoJSON data from a variable instead of a file is a feature implemented by

Let's say I have a geoJSON data stored in a variable or parsed as an object: // GeoJSON stored as an object var segment = segment; // GeoJSON saved as a JSON string var json = JSON.stringify(segment); Now, the challenge is to display this geoJSON o ...

Connect the scroll wheel and then proceed to scroll in the usual way

There are two div elements with a height and width of 100%. One has the CSS property top:0px, while the other has top 100%. I have implemented an animation that triggers when the mousewheel is used to scroll from one div to the other. The animation functi ...

Is there a way to position the text within an email body at the center using SendGrid?

I've been working on creating an email newsletter template using SendGrid, and I've run into a formatting issue where the content doesn't align properly in the email body. The image below shows how it's appearing incorrectly. Does anyon ...

Is it possible to adjust the JavaScript slider effect to transition to a fade effect when the window width drops below 800 pixels?

Is there a way to make my JavaScript slider change its effect from normal to fade when the browser window is less than 800px wide? Any assistance would be greatly appreciated. <ul class="slider"> <li><img src="images/1" alt=" ...

Maintaining state value during client-side navigation in NextJs with Next-Redux-Wrapper

Currently, I am working on resolving the hydration issue that occurs when using wrapper.getServerSideProps. The problem arises when I reroute with the existing setup and the store gets cleared out before adding new data. This leads to a blank page as essen ...

The current URL in the browser does not change

My HTML form has a JavaScript function that involves handling the window.location.href. I successfully remove two unwanted query string parameters from the source using this function, as shown in the first and second alert screenshots. However, I encounte ...