Unable to shift to the side while in full flexibility mode

I ran into an issue with my code, shown in the image below. I am trying to position 1 on the left and 2 on the right, but something seems off. Can you spot the problem?

<div className="mt-5 mx-5 py-3 shadow bg-white">
  <div className="d-flex justify-content-center">
    <div style={{ float: "left", display: "flex" }}>
      <div className="p-2">1</div>
    </div>
    <div className="p-2 me-4">Popular Products</div>
    <div className="p-2">Low Price</div>
    <div className="p-2 ms-4">High Price</div>
    <div style={{ float: "right", display: "flex" }}>
      <div className="p-2">2</div>
    </div>
  </div>
</div>

Answer №1

https://i.sstatic.net/ll0zN.png https://i.sstatic.net/CzCzs.png the key is to utilize justify-content-between

    <div className="mt-5 mx-5 py-3 shadow bg-white">
            <div className="d-flex justify-content-between">
                <div>
                    <div className="p-2">1</div>
                </div>

                <div className="d-flex justify-content-center w-100">
                    <div className="p-2 me-4">Popular Products</div>
                    <div className="p-2">Low Prive</div>
                    <div className="p-2 ms-4">High Price</div>
                </div>

                <div>
                    <div className="p-2">2</div>
                </div>
            </div>
        </div>

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

Immer along with a subclass of Map

Recently, I decided to implement useImmerReducer in my React application for the first time, but encountered an issue. In my project, I utilize a custom class called Mappable, which is derived from Map: import { immerable } from "immer"; type K ...

How can I utilize FileReader with Next.js server-side rendering?

I'm currently working on a Next.js app, and I am facing an issue while trying to use FileReader in order to read the contents of an uploaded file. This is how my component is structured: let fileReader; let props = { multiple: false, onRe ...

Using ReactJS to toggle a div upon clicking

I am facing an issue with toggling a div by clicking on text within a toggle bar. I am in the process of recreating a WordPress website template in React JS that was originally built using bootstrap. You can view the original template here. So far, I have ...

Steps icons in the MUI Stepper component can be adjusted to remove the space between line connectors

I'm running into an issue while attempting to build a Stepper component using MUI V5. The problem I am facing is the presence of a gap between the icons and the line connectors. Here's what my current setup looks like: https://i.sstatic.net/UoMs ...

The swipe function of Hammer.js is unable to detect gestures on a rotated iframe

After creating a rotated iframe on the page using CSS transforms, I attempted to implement swipe events within the iframe. body.rotate iframe { transform: rotate(90deg); transform-origin: top right; position: absolute; t ...

How to verify if a node contains plaintext with jsoup?

Is there a way to determine if a node in jsoup has plain text without including link text, instead of using the Element.hasText() method? Any suggestions would be greatly appreciated. Thank you ...

Encountering a Spring Boot 403 Forbidden Error while attempting to access the web application (index.html) as well as the ReactJS app

I have added the index.html file to my spring boot application's 'src/main/resources/static' folder so that I can access the web page while running the server. This setup works fine in another spring boot application without the configuratio ...

Don't display div if database has certain value - Angular

Is there a way to determine if a specific value exists in a PostgreSQL database? If so, can I then hide an HTML element based on this information? Can CSS and JavaScript be used to hide elements, or is there another method that should be utilized for hidi ...

Press the html button and activate the button using Visual Basic

Being new to Visual Basic, I have created a simple app using the WebBrowser component. The web page that loads contains an HTML button. I want this HTML button press to enable a button in Visual Basic, but I don't know how to do it. I have researched ...

Using select tags in conjunction with JavaScript can add dynamic functionality to your website

I've been working on adding dropdown menus to my website and have been using code similar to this: <select> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</opti ...

Clicking on the <Link to=URL> in a React application built with Typescript and Redux triggers the disappearance of the component

Issue Background The application was created using npx create-react-app rrts --typescript, which sets up React, Redux, and Typescript. Problem Visualization (Content is the component with sentences) View Problem Image Here Problem Description Clicking o ...

What are the steps for implementing a two-column layout in reveal.js?

When creating my slides using reveal.js, I write them in Markdown code. I am now looking to present my content (text, bulleted lists, or images) in a traditional two-column text layout. While I am open to a more complex initial setup, I want to ensure that ...

Table that has a border before the first row but no border after the last row

I recently upgraded my project from Bootstrap 4 to 5 and noticed a change in the display of tables. In Bootstrap 5, borders are no longer drawn above the first row (without a header), but below the last row. Is there an easy way to revert to the old behav ...

Submission of the form was cancelled, causing a loop to occur

I'm encountering an issue with submitting a file through a standard HTML form. After uploading the file, the process seems to get trapped in a continuous loop where the file keeps uploading repeatedly. The submission of the form is done using jQuery, ...

What is the best way to activate an @keyframe animation based on the scrolling action?

I am currently working on an @keyframe animation that rotates a circle along its x-axis, starting from 0 degrees to 90 degrees and then back to 0 degrees. My objective is to synchronize the rotation of the circle with the user's scrolling movement on ...

Invoking a child function within a parent component utilizing react hooks

I have some action buttons in a parent component and I want to trigger a function in a child component when one of these buttons is clicked. I have been trying to implement this using the useRef hook, but it feels cumbersome and I also receive a warning: ...

TS7053: The element is implicitly assigned an 'any' type as the expression of type 'string' cannot be used to index the type '{ username: string; email: string; '

Having trouble incorporating TypeScript into a custom React Form Component, and I keep encountering an error that I can't seem to resolve. Error message TS7053: Element implicitly has an 'any' type because expression of type 'string&apo ...

Custom Homepage with Integrated Google Web Search and Autocomplete Feature

Is there a way to incorporate the standard Google web search with autocomplete into my own webpage, without using a custom search engine like www.google.com? I have been unable to find any examples or guides on how to accomplish this. All the resources see ...

When fetching data from a parse object, JavaScript displayed [object, Object] as the result

When trying to access information from my parse data, I am able to display user table data on my document without any issues. However, when I attempt to query another object and insert it into an id element using jQuery with functions like text();, html(); ...

Prevent input element from being included in tab order in Internet Explorer

I’m facing an issue in my Single Page Application built with vue.js. I have a checkbox that needs to be invisible for UX reasons, so I set its opacity to zero. However, even with tabindex set to -1, the input element is still included in the tab order ...