What are the steps to align content within a column in Bootstrap?

I need help aligning two elements, one on the left and one on the right inside a Col, and make them horizontal. I tried using justify-self: right; to position the div on the right but it's not working. Here is my code:

<Col xs="12" className={item.subscription === 'PREMIUM' ? 'mb-1 d-flex justify-content-md-end cursorPointer' : 'mb-1 d-flex justify-content-md-end align-items-end cursorPointer'} >
                { item.subscription === 'PREMIUM' && (
                <div className={`${styles.superDiv}`}>
                  <img
                    src="/svg/e.svg"
                    alt=""
                    height="26"
                    width="26"
                    className="mr-2"
                  />
                  <span className={styles.super}>Super</span>
                </div>
                )}
                <span className={styles.price}>{`${item.price}$`}</span>
                <span className={styles.for}>/H</span>
              </Col>
.superDiv {
    align-content: center;
    text-align: center;
    justify-self: right;
    width: 150px;
    padding: 0.5rem;
    border-radius: 100px;
    background: white;
}

Can anyone suggest how to achieve the desired result?

Answer №1

To ensure the first item is on the start line and the last item is on the end line within your parent element (in this case, subscription), you can simply add Justify-content:space-between; to the parent element's CSS styling:

.subscription {
       display: flex;
       Justify-content: space-between;
}

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

Bootstrap for arranging DIVs in a responsive manner

I am trying to place some DIV elements inside their parent container, whether it is the body, a table's cell, or another div, using Bootstrap 5. The desired layout is shown on the attached illustration: https://i.sstatic.net/QKwjK.png If there is an ...

Apply a CSS class to the initial item in each carousel present on a webpage

I am utilizing Bootstrap 4's carousel to showcase dynamic content. The challenge lies in marking the first item of the carousel with the CSS class ".active". While it is typically added directly in the HTML, it becomes complicated when dealing with dy ...

Tips on displaying the number of items ordered above the cart icon

Hey there, I've been attempting to place a number in the top left corner of a cart icon without success. My goal is to achieve a result similar to the image shown here: enter image description here Here is the code snippet I've been using: < ...

Unable to alter the css of a jQuery object

I have been attempting to modify the CSS of two child elements of a specific element using Backbone and jQuery. However, my code does not seem to be working as expected. I suspect that the issue lies in distinguishing between a DOM element and a jQuery obj ...

Configuring a JavaScript calendar with custom margins

Having trouble selecting a date with the Bootstrap datepicker class. After running the snippet, the calendar appears below the textbox: <input type="text" class="form-control datepicker" name="due_date" id="due_date" onclick="calendar_up()" value="" pl ...

The fonts in node.js are not functioning as expected, without displaying any error messages

I'm having trouble implementing custom fonts on my website. Despite following the correct file structure, the fonts do not seem to be loading. My project files are organized in the following manner: https://gyazo.com/5ee766f030290e5b2fa42320cc39f10b ...

The .AppendChild() method does not appear to be working as expected following the completion of

Encountering a peculiar problem here. The scripts run smoothly, but the content doesn't display on screen until I "inspect element" and then close the inspector window or zoom in/out. It's not an issue with the "display" CSS property because even ...

Issue with Navbar collapse button not displaying items on Bootstrap 4.5.0 in combination with Next.js version 9.4.4

I'm currently working on a nextjs demo project where I'm incorporating bootstrap for styling purposes. The initial setup was straightforward as I installed bootstrap using npm and included it in my app.js. import 'bootstrap/dist/css/bootstra ...

The icon for the weather on openweathermap is currently not displaying

Take a look at what my webpage looks like: http://prntscr.com/dg6dmm and also check out my codepen link: http://codepen.io/johnthorlby/pen/dOmaEr I am trying to extract the weather icon from the api call and display that icon (e.g. "02n") on the page base ...

Incorporate an SCSS file into the Stackblitz project

Is there a way to include an scss file in the stackblitz? I attempted it, but encountered some issues. Could you take a look and advise me on what to do? I also made an attempt to add home.html This is the project: Check out the stackblitz project here! ...

When you click on links and buttons, a focus outline appears

I am currently troubleshooting an issue within an existing application that relies on the use of jQuery. The problem arises when I click on any link or button on the page, causing the element to display a focus outline (such as a blue glow in browsers like ...

Tips for displaying an asp.net form using javascript functions

I am currently developing a login page in asp.net and have utilized a template from CodePen at http://codepen.io/andytran/pen/PwoQgO It is my understanding that an asp.net page can only have one form tag with runat="server". However, I need to incorporate ...

display of an image with a pop-up feature in Bootstrap 4 beta

I've implemented modals on this page. The website has been updated to BS4 beta. Visit this page and when you click on an image, a pop up or modal should appear with the image. <div class="row mb-2"> <div class="col-lg-2 col-sm-3 co ...

Adaptive video player for complete YouTube experience

Is there a way to incorporate a YouTube video as the background of a div, similar to how it is done on this site, using a <video> tag and ensuring that the video "covers" the entire div without any empty spaces while maintaining its original ratio? ...

Display the badge in Bootstrap only on smaller screens

My dashboard features a navigation bar built on MVC Razor and Bootstrap, showcasing labels and badges. <span class="btn btn-danger" style="pointer-events: none;">Alert<span class="badge badge-pill badge-default">@alerts</span></s ...

Issue with displaying list items in Ajax Accordion with CSS

I have implemented an accordion control extender on my webpage, and it is functioning properly. I added a CSS file to display it as a list, which is working perfectly in all browsers except for IE compatibility view. In IE compatibility view, the list-styl ...

Issues with Vue enter transitions not functioning as expected

I am currently involved in a project where I need to implement enter and exit animations for some components. When a component enters the screen, it should come from the bottom, and when it leaves, it should go upwards. The intended functionality is that w ...

CSS functioning properly on Localhost, but encountering issues on the Server

I am encountering an unusual issue. After developing a website using ASP.NET The problem I am facing is : While the website works perfectly on my local server and all pages display correctly, once I uploaded the files to my GoDaddy hosting account, the ...

Is there a way to trigger the opening of a new file or page when a CSS animation comes to an end?

Is there a way to delay the loading of a function or page until after an animation has finished running in JavaScript, HTML, and CSS only? For instance, I'd like to run an animation first and then have a different website or content load afterwards fo ...

Create a layout consisting of two rows, each containing three blocks. Ensure that the layout is responsive by using only HTML and CSS, without relying

Hello there! I am looking to create a responsive layout without using bootstrap or any other framework..... I want to build it from scratch. https://i.stack.imgur.com/GAOkh.png I am aiming for responsive blocks that collapse into one column when the page ...