Arrange all the items in the list to be aligned on a single

Here is the code and styles I have in my project:

I want to align the texts and span style.

My default code looks like this:

body {
direction: rtl;
}
div {
  position: absolute;
  top: 30px;
  right: -100px;
  height: 300px;
  overflow-y: scroll;
  background-color: #fff;
  box-shadow: 1px 1px 5px rgb(0 0 0 / 10%);
  border-radius: 15px;
}
li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

span {
  background-color: #eeeeee;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}
     <div>
       <ul>
          <li>
            English<span></span>
          </li>
          <li>
            Spanish<span></span>
          </li>
          <li>
            French<span></span>
          </li>
          <li>
            Russian<span></span>
          </li>
          <li>
            Arabic<span></span>
          </li>
          <li>
            Japanese<span></span>
          </li>
          <li>
            indian<span></span>
          </li>
        </ul>
      </div>

I want to make my list look like the image above:

How can I align it like the image above? (My body direction is rtl)

Answer №1

modify

li { justify-content: space-between; }
to
li { justify-content: flex-end; }

body {
  direction: rtl
}

li {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
}

span {
  background-color: #eeeeee;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}
<div>
  <ul>
    <li>
      English<span></span>
    </li>
    <li>
      Spanish<span></span>
    </li>
    <li>
      French<span></span>
    </li>
    <li>
      Russian<span></span>
    </li>
    <li>
      Arabic<span></span>
    </li>
    <li>
      Japanese<span></span>
    </li>
    <li>
      indian<span></span>
    </li>
  </ul>
</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

PHP-powered image gallery system with a robust search engine

My current project involves creating an image gallery system that is keyword-driven. For each image, there is a corresponding .php file containing the following variables: $keywords = 'Keywords that describe the image'; $src = 'dir ...

If the text is too wide for the parent div width, wrap it in a child div

<div class='jfmfs-friend' id='123'> <input type='checkbox'/> <img src='id.jpg'/> <div class='friend-name'>Himanshu Yadav</div> </div> I am looking to modify the st ...

How to prevent labels from overlapping textboxes when the labels are lengthy using CSS

I am having an issue with an asp control that renders as a text area. I have applied some CSS to style it, but I am facing a problem where a long label is overlapping the textbox. Is there any CSS I can add to push the textbox down if the label gets too lo ...

Javascript isn't being executed by Internet Explorer as expected

I'm currently working on a web application that requires backend processing while simultaneously showing the information on the screen. AJAX seems like the ideal solution, so I've implemented it in my project. However, before initiating the AJAX ...

Angular2's customer filter pipe allows for easy sorting and filtering of

Check out the component view below: <h2>Topic listing</h2> <form id="filter"> <label>Filter topics by name:</label> <input type="text" [(ngModel)]="term"> </form> <ul id="topic-listing"> <li *ngFo ...

What is the process to change the URL?

Currently, I am deep into developing a large-scale web application for a company. The project has been ongoing for about four months now, and we have encountered a harmless yet annoying issue that we haven't had time to address. The problem lies in t ...

The width of the unordered list is not what I defined

when I set this line: <ul style="width:100px; height:100px; background-color:green"> <li style="width:100px; height:100px; border:1px solid blue"> 1 </li> </ul> The ul ends up wider than my specified 100px width. Any thoughts ...

Transferring data between two screens within an Ionic app by harnessing the power of angularJS

As a beginner in Ionic and Angular development, I am currently facing an issue with my Ionic application. I have two pages - one with drop-down selects and a submit button, and another page to process the user's choices and display the results. The pr ...

Is it necessary to properly close meta and link tags in HTML documents?

As I inspected someone's HTML, I noticed that they didn't close the meta and link tags in the head section. Surprisingly, the code still worked perfectly fine; does this mean closing these tags is purely optional? I always believed that leaving ...

Effortlessly switching classes in JavaScript for seamless transitions

I'm currently working on an animation project where I want the title to be visible on the page initially, and then slowly fade away as you scroll down, with a subtitle fading in right after. While I've managed to get the title part working, I&apo ...

Shifting an image within a canvas upon loading the webpage

Demo var stage = new Kinetic.Stage({ container: 'container', width: 578, height: 200 }); var layer = new Kinetic.Layer(); var imageObj = new Image(); imageObj.onload = function() { var yoda = new Kinetic.Image({ x: ...

Issue with connecting the 'Enter' key to the button - no success

My current setup involves using jQuery to link the Enter key to an HTML button through this code snippet: $("#console").keyup(function(event){ if(event.keyCode == 13) { $("#submit").click(); } }); HTML: <input autocomplete="off" type= ...

Attributes required are not functional on mobile devices

Good day! I have encountered an issue with the required attribute on a form on my website. It seems to be working perfectly on my browser, but not on mobile devices. Has anyone else experienced difficulties with jQuery, JavaScript, or Node packages? <f ...

Determining the orientation of an image in JavaScript

Currently, I am attempting to determine the orientation of images using JavaScript in order to apply a specific class to them. This process seems to be functioning correctly on Firefox, but is presenting challenges on other browsers. It appears to work bet ...

How can you correctly include a link to a plain text sitemap file in an HTML document?

Could this code effectively inform Google to index my sitemap (or acknowledge its presence)? <link rel="sitemap" href="./sitemap.txt" type="text/plain" title="Sitemap" /> Google's guidelines allow plain t ...

Automatically fill in checkboxes based on user input

Having a simple problem here, I am attempting to dynamically populate check-boxes in an HTML form. However, when I try using the checked property of the checkbox in HTML, it doesn't work correctly. The checkbox remains checked whether I use checked=&a ...

Personalized text hues for your WordPress product page

As someone who is new to all of this, please keep that in mind :/ I decided to remove the "add to cart" button from my theme (blocksy) so I could insert my own buttons within the product page under the "short description" text. I needed two "download" but ...

How can I efficiently make a dropdown menu with search functionality instead of using datalist?

I am currently working on creating a custom searchable input field that makes backend calls. Instead of using datalist, I want to design a unique UI with ul and li items. While I have successfully implemented the search functionality, I am facing a glitc ...

"Showing Off Your Steam Inventory on Your Website: A Step-by-

My goal is to display a user's specific inventory on a webpage. I've tried using the following link: but it hasn't been helpful. ...

Button will be disabled unless a value is selected in the dropdown menu

I am currently dealing with a code issue where the button is disabled on page load when the dropdown value is empty. However, even after selecting a value from the populated database dropdown, the button remains disabled. Jquery: <script> $(doc ...