The alignment of items along with the justification of content is experiencing malfunction

How can I align the two li elements in the last row to be next to each other rather than in the middle? I am using flexbox for responsiveness on smaller screens.

Check out my code on CodePen

ul {
  display: flex;
  margin: 0 auto;
  padding: 0;
  width: 800px;
  list-style: none;
  flex-wrap: wrap;
  background-color: red;
  justify-content: space-between;
}

li {
  display: flex-item;
  padding: 15px 0;
  transition: transform .5s ease-in-out;
  transform: scale(1);
  margin: 10px auto;
  background-color: blue;
  width: 150px;
}

Answer №1

Give this a shot:

ul {
  display: flex;
  margin: 0 auto;
  padding: 0;
  width: 800px;
  list-style: none;
  flex-wrap: wrap;
  background-color: red;
  justify-content: space-between;
  display:inline-block;
}

li {
  display: flex-item;
  padding: 15px 0;
  transition: transform .5s ease-in-out;
  transform: scale(1);
  margin: 10px auto;
  background-color: blue;
  width: 150px;
  display:inline-block;
}

Check out the DEMO HERE

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

problems with an extra administrator account access

Is it possible to have a single login form that can cater to both users and admins? I currently have a user login system in place but would like to add an admin login as well. How can I implement this without creating separate logins? if(isset($_POST[&ap ...

Error message: PHP uninitialized array key within nested if statement

Encountering an issue with Undefined Index on line 2 in this scenario: if ($_POST['go'] == 'create') { Aware that resolving it requires using isset, but unsure how to implement it within another if statement. Appreciate any help, tha ...

Customizing PrimeNG Dropdown: Concealing input and label elements with personalized styles

New to working with PrimeNG here. I'm looking for a way to get rid of the input and label elements in my project or simply hide them using CSS. I've heard that setting ViewEncapsulation to None is not the best solution. Currently, my component is ...

How to create a see-through background using three.js

I am new to working with three.js and recently came across a codepen that caught my attention. However, I am facing difficulties while trying to change the background color. After exploring various questions related to this issue, I attempted to add { alp ...

Using the CSS property 'clear' creates a significant gap in the layout

Using a div like this to clear space after floats: .clear { clear:both; } However, the formatting is getting messed up with extra space. Any ideas on how to fix it? Appreciate your help! ...

jquery is used to make the search auto suggest list open in the opposite direction, moving from bottom to top

I've successfully implemented a search box with auto-suggestion using jQuery. However, I am facing an issue where the list opens from top to down by default. Is there a way to make it open in the opposite direction, from down to up? Below is the HTML ...

Having trouble with a static CSS file not loading correctly in the Django admin interface

Currently, I am attempting to replace the base.css file with my own custom CSS file in order to personalize the appearance of Django Admin. {% extends "admin/base.html" %} {% load static %} {% block title %}Custom Django Admin{% endblock %} {% block bran ...

Issues with table formatting and malfunctioning functions

I created a basic tic-tac-toe game, but I'm having an issue with the table display. It appears squished when the game loads. Is there a way to prevent this and keep the table empty? Additionally, I am using NotePad++ and encountering problems running ...

Having trouble locating an element with Xpath using Selenium Web Driver? Any suggestions for a more efficient way to find this elusive element?

Selenium Web Driver- I'm having trouble locating an element using Xpath. Any suggestions on a better way to locate the element below? <div class="gwt-Label">Declined</div> I attempted to retrieve the text in the element using the followi ...

Extracting information from the database using PUG

There is a situation with the data in my mongo database that I can't seem to control. When exporting data from my application to the database, it seems to update the html tags (I believe the term is 'encoding' but I am not entirely sure). &a ...

Tips on Creating a Display None Row with a Sliding Down Animation Using Javascript

I am working with a table that has some hidden rows which only appear when the "show" button is clicked. I want to know how I can make these hidden rows slide down with an effect. Here's the snippet of my code: function toggleRow(e){ ...

Select a checkbox from a dropdown menu

I need help with automatically checking a checkbox when an option is selected from a dropdown menu. Here is an example of the HTML code: <table> <tr> <td> <input type="checkbox" name="check1" />Process 1:< ...

What is the method for adding up elements based on their identification numbers?

Is it possible to calculate the sum of multiple range sliders using their unique IDs? Multiplying each range slider value by the corresponding input. And finally, adding up all the multiplication results. $(document).ready(function() { $(".range") ...

Utilize the Step Function in Jquery to create animated rotation at a specific degree angle

I have a div that is currently rotated at -35 degrees (as set in the CSS file). I would like to be able to click on it so that it rotates back to 0 degrees. Here is the code from my Javascript file: $("div#words").on("click",function(e){ $(this).anim ...

bootstrap3 container alignment

I encountered a challenge while attempting to right-align multiple Bootstrap 3 containers in a straightforward manner. Despite my efforts, achieving this proved to be more complex than expected. In essence, I faced an issue where aligning the text box with ...

Switch the checkbox back if an error occurs

I'm having an issue with a styled checkbox that appears to flip when clicked. Upon user interaction, the checkbox visually flips on the client side, while sending a request to save the change in a database on the server. In case of an error, I need to ...

Leveraging Javascript/Jquery for numbering items in a list

This is a snippet of HTML code that I am working with: <ul> <li data-slide-to="0" data-target="#myCarousel" class="appendLi"></li> <li data-slide-to="0" data-target="#myCarousel" class="appendLi"></li> <li data ...

Tips for positioning a Wordpress navigation bar to the right of a logo

My goal is to position the navigation bar next to the logo in my Wordpress theme using Underscores. I have successfully aligned the primary navigation and the logo as desired with the following CSS: .main-navigation { position: relative; float: ri ...

What are the steps to create a reliable menu?

Looking to add a fixed menu to my website that stays at the top even when scrolling down the page. For an example, check out iplex.co.in for a demonstration. ...

The issue with jquery's marginTop functionality appears to be malfunctioning

Is there an easy way to vertically center text of unknown height within a div of known height? I've experimented with the css display: table-cell option without success, so I'm currently using jQuery to detect the height and apply a top margin if ...