Tips for switching a bootstrap navbar alignment from right to left

I have integrated the navbar component on my website, but I am looking to align it from right to left so that "Toursitation" (Brand Name) appears first on the right side. Can someone please assist me?

Below is the code for the current navbar:

<Navbar bg="dark" expand="lg" style={{"padding": "0 10px", "background-color": "#132c33 !important"}}>
  <Navbar.Brand href="/">TouriStation</Navbar.Brand>
  <Navbar.Toggle aria-controls="basic-navbar-nav" />
  <Navbar.Collapse id="basic-navbar-nav">
    <Nav className="mr-auto">
      <Nav.Link href="/events" className="navbarSections">Events</Nav.Link>
      <Nav.Link href="/resturants" className="navbarSections">Restaurants & cafes</Nav.Link>
      <Nav.Link href="touristic" className="navbarSections">Touristic</Nav.Link>
      <Nav.Link href="accommodations" className="navbarSections">Accommodation</Nav.Link>
      <Nav.Link href="malls" className="navbarSections">Malls</Nav.Link>
      <Nav.Link href="extraservices" className="navbarSections">Extra services</Nav.Link>
  </Nav>

    <Form inline>
      <FormControl type="text" placeholder="Search" className="mr-sm-2" value={this.state.search} onChange={this.onChangeSearch}/>
      <Button variant="outline-info" onClick={() => window.location = "/Search/"+(this.state.search)}>Search</Button>
    </Form>    



      <SplitButton style={{"display": this.state.user ? "none" : "block", "color": "white", marginLeft: "0.5%"}} class="text-white"
      menuAlign={{ lg: 'right' }} 
      title="Join Us" 
      id="dropdown-menu-align-responsive-2" 
      variant="info"
      >
                <Dropdown.Item href="/login">Login</Dropdown.Item>
        <Dropdown.Divider />
        <Dropdown.Item href="/register">Register</Dropdown.Item>

    </SplitButton>


    <SplitButton style={{"display": this.state.user ? "block" : "none" , marginLeft: "0.5%"}} class="text-white"
      menuAlign={{ lg: 'right' }} 
      title="Profile" 
      variant="info"
      id="dropdown-menu-align-responsive-2" > 
    <Dropdown.Item href="/newplace" style={{"display": this.state.user && this.state.Nonuser ? "block" : "none"}}>New Place</Dropdown.Item>
    <Dropdown.Item href="/newevent"  style={{"display": this.state.user && this.state.Nonuser ? "block" : "none"}} >New Event</Dropdown.Item>
    <Dropdown.Divider style={{"display": this.state.user && this.state.Nonuser ? "block" : "none"}} />
    <Dropdown.Item href="/profile">My Account</Dropdown.Item>
    <Dropdown.Divider />
    <Dropdown.Item href="http://localhost:3000/logout/">Sign Out</Dropdown.Item>
</SplitButton>
      </Navbar.Collapse>  
        </Navbar>

Update: If I use `me-auto` or `.flex-row-reverse`, it will look like this: https://i.sstatic.net/iPojy.png

The original design looks like this:

https://i.sstatic.net/28W57.png

Answer №1

delete the 'mr-auto' class from the code snippet below.

    <Nav>
      <Nav.Link href="/events" className="navbarSections">Events</Nav.Link>
      <Nav.Link href="/resturants" className="navbarSections">Restaurants & cafes</Nav.Link>
      <Nav.Link href="touristic" className="navbarSections">Touristic</Nav.Link>
      <Nav.Link href="accommodations" className="navbarSections">Accommodation</Nav.Link>
      <Nav.Link href="malls" className="navbarSections">Malls</Nav.Link>
      <Nav.Link href="extraservices" className="navbarSections">Extra services</Nav.Link>
  </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

Intrigued by the prospect of making HTML elements vanish or smoothly glide along with the content without obstructing it

I'm a beginner in coding and I want to make my website impressive. Right now, I have an HTML embedded element called "On this Page" that I would like to disappear when the user scrolls down the page. I've managed to position the element on the ...

PHP solution for parsing the HTML content generated by AJAX requests

As of now, I am utilizing curl to authenticate on a website and retrieve the html content of a specific page. However, my issue arises when trying to handle ajax links on the page which trigger changes in the html upon clicking. How can I simulate these ...

Develop an engaging billboard carousel using jQuery

After coming across a tutorial on tympanus, I decided to make some modifications to create a rotating billboard effect. However, something seems to be going wrong and it's driving me crazy trying to figure out the problem! $(function() { $('#ad_ ...

What is the best way to ensure a grid remains at 100% width when resizing a browser window?

Within the div element, I have two child divs. One has the class col-md-2 and the other has the class col-md-10.Check out a sample view here In the image provided, the div containing hyperlinks (Database edit, invoice, preview) is not taking up 100% width ...

What is the best way to align certain <li> elements to the right side of a navbar?

After logging in, I am attempting to position specific links on the right side of my navbar. I have tried using pull-right and float-right, but neither seem to work. Can someone clarify why? Below is my code: <header style="background-color:black ...

When I try to call jQuery's getScript function, the callback does not execute as expected within

When I invoke the script in a function at runtime function CheckOutMyFace() { $.getScript("/scripts/jtimers.js", function (data) { }); }; I notice in Firebug that the script is being called every time the function is invoked, but for some reason the ...

Is there a way to prevent HTML code from being executed when sharing it as text? I want to be able to share code without it being activated as HTML on the page

Seems like I have a straightforward issue related to HTML tags. I am looking to post some code snippets on my blog, specifically the <h1> heading</h1>. I want visitors to view and not just the bolded text of heading. Do I need to incorporate J ...

Tips on Importing a Javascript Module from an external javascript file into an <script> tag within an HTML file

I'm facing an issue while attempting to import the 'JSZip' module from an external node package called JSZip in my HTML File. The usual method of importing it directly using the import command is not working: <script> import ...

Off-center alignment in left margin with Bootstrap 3

When using bootstrap 3, I have noticed that the left margin starts to indent gradually with each row. Here is a screenshot demonstrating the issue: please see here The code for the first two rows in the image looks like this: <div class="row"> ...

What is the best way to use jQuery to adjust the size of a slider image based on a percentage of the browser window

I've been searching all over for a solution to this issue, but so far I haven't had any luck. Basically, I have an image that is 1800 pixels wide by 500 pixels high. I need this image to adapt to all screen resolutions. Instead of having a fixed ...

Ways to position 4 containers next to each other using CSS

I need help aligning 12 buttons in a specific layout: 4 buttons on the top and 3 on each side to total 12 buttons. Also, I want 2 additional buttons at the top left (Div/Mult) and top right (Add/Sub). Below, you'll find the HTML and CSS documents. If ...

Adjusting the background color of the custom input range thumb when the input is disabled

I've customized the input thumb on my range slider, and I'm looking to change its color when it's disabled. I attempted adding a class to the thumb like this: input[type=range]::-webkit-slider-thumb.disabled and also tried adding the disa ...

JavaScript is failing to pass the argument value

Whenever I attempt to pass a value on an onclick=function('') function, the value does not seem to get passed correctly while ($row = mysqli_fetch_array($result)) { $id = $row['id']; echo '<a href="#" onclick="DeleteUse ...

The content section sits discreetly behind the sidebar

Upon loading my Bootstrap 5 webpage, the toggle button successfully moves the navbar and body section to show or hide the full sidebar. However, an issue arises where the body section goes behind the sidebar when using the toggle button. Below is a portio ...

JavaScript error message stating that the setAttribute function is null

As a newcomer to JS, I am currently working on creating a task list webpage that allows users to submit projects and create task lists within each project with designated due dates. In order to generate unique ID tags for projects and tasks, I utilized UU ...

Positioning the fourth object aligned to the right side within a map function in React using Bootstrap col-md-4

There are 9 objects in an array, and I want to display them with 3 items in one row. The first row looks fine, but the first item of the second row is moving to the right side. <div className='row'> { services? services.map((d, i) => ...

Arrange the table in alphabetical order and categorize it

Hello there! I am currently working on creating a well-organized table list where names are sorted into specific categories based on their starting letter. For example, names beginning with 'A' will be placed in the 'A category', while ...

Turn off automatic calling of Javascript function via the menu

Can anyone help me with calling a JS function from an action link? Here's my declaration: <li><a href="javascript:myFunc()"><span class="glyphicon glyphicon-ok"></span>&nbsp;Test</a></li> The issue is that the ...

Switch up the design on Bootstrap 4 navigation tabs

Trying to customize the appearance of the current tab in a nav-tabs setup has been a bit challenging. I've created a simple file to test this functionality. When a tab is clicked, the content switches correctly, but I'm struggling to apply specif ...

Is it possible to showcase two modals on a single page, positioning one to the left and the other to the right using Bootstrap?

Can someone help me learn how to display two modals on the same screen, one on the left and one on the right? I am new to bootstrap and would appreciate some guidance! ...