How to adjust the second line in a list style when the text is too long?

Recently, I started working on web development and came across an issue. While designing a mobile website, the list text was breaking into a second line, making it look unattractive. I wanted to adjust the second line to align with the start of the text. My current framework is bootstrap 5.

This is how my list currently looks: View

I want it to look like this: Desired Look

HTML

        <div class="col">
          
          <ul>
            <p class="col align-self-center">
            <li><i class="fa-solid fa-fish"></i>5% marketing and strategic alliances</li> 
            <li><i class="fa-solid fa-fish"></i>10% Metadata release (Rarity tools) Focus on community growth</li>
            <li><i class="fa-solid fa-fish"></i>25% Listing in Magic Eden</li> 
            <li><i class="fa-solid fa-fish"></i>50% First Donation to partners</li> 
            <li><i class="fa-solid fa-fish"&
            gt;</i>65% Increase in marketing investment</li> 
            <li><i class="fa-solid fa-fish"></i>80% Bluepaper Publication of Phase 2</li> 
            <li><i class="fa-solid fa-fish"></i>100% Second Donation to partners</li> 
            </p>
          </ul>
        </div>
  
      </div>

CSS

  .Roadmap-body li {
      list-style: outside;
      padding: 0% 0% 5% 0%;
      text-align: left;    
      width: 100%; 
        margin-left: auto; 
        margin-right: auto; 
 
    }

    .fa-fish{
      padding-right:  7%;
    }

Thank you in advance for any help provided!

EDIT: I changed the ui tag to ul, now the design looks like this see image description here

Answer №1

To apply display: inline-flex to all li elements, you can use the following CSS code snippet. Keep in mind that utilizing this property will eliminate the bullet points.

If you prefer to maintain the icons alongside the bullets, consider implementing the example below:

.parent > li{
  display: inline-flex;
}
.fixed-icon{
  background:red;
  white-space: nowrap;
  margin: 4px;
  position: relative;
}
.fixed-icon::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: black;
  border-radius: 100%;
  position: absolute;
  left: -13px;
  top: 5px;
}
<ul class="parent">
  <li>
    <i class="fa-solid fa-fish fixed-icon">Icon 1</i>
    Lorem ipsum dolor sit amet
  </li>
  <li>
    <i class="fa-solid fa-fish fixed-icon">Icon 2</i>Lorem ipsum dolor sit
    amet, consectetur adipiscing elit
  </li>
</ul>

Answer №2

Working with tables can be challenging when it comes to aligning content properly. Instead, you can consider using a Flexbox solution to achieve more freedom in content alignment and solve any line break issues.

Check out the HTML code for the Flexbox solution below:

<div class="test-container">
    <div class="test-item">
        <i class="fa-solid fa-circle-small"></i>
        <i class="fa-solid fa-fish"></i>
        <p>5% marketing and strategic alliances</p>
    </div>
    ...

    ... // More test-items here

    ...
        
</div>

And here's the corresponding CSS code:

.fa-fish{
    margin: 0 10px;
}

.test-item {
    display: flex;
    align-items: center;
}

This is just a basic example that can be further enhanced with minor adjustments to the CSS and HTML. Note that I have used Font Awesome small circle icons as bullet points for the list items. Feel free to explore different approaches and I hope this solution proves helpful!

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

Arrangement of items in a grid featuring a row of three items, each with an automatic width

I'm facing challenges with achieving a specific layout: https://i.sstatic.net/a5ETh.png https://i.sstatic.net/I7fuS.png My goal is to have the left and right elements automatically adjust their width to cover all the empty space on either side of t ...

Convert the easeInExpo function from jQuery easing to vanilla JavaScript and CSS

Currently, I am in the process of converting a piece of code from jQuery to plain JavaScript and CSS. The specific code snippet I am focusing on involves creating easing functions without relying on jQuery. const customEasing = { easeInExpo: function ( ...

What is the best way to conceal a row when a particular field is devoid of content?

Is it possible to hide an entire table row if a field is empty? For example: https://i.sstatic.net/tMW7L.png If a certain field is empty, I want the entire row to be hidden, either using JavaScript or jQuery. I have tried some methods but none of them fu ...

Ensure a minimum width is applied to a specific tooltip in Bootstrap that has a dynamically generated ID

I am working on an html view using Thymeleaf. The view contains a large table with various tooltips that have a style applied which is functioning correctly. However, I am now facing the challenge of adding a min-width specifically to the tooltips within a ...

Using a custom HTML file as a container in an Android WebView

I am trying to include each loaded page within my own custom HTML file. My app needs to first parse the loaded page, select the body tag, insert it into my custom HTML file, display it in a WebView, and continue this process for each subsequent page. I h ...

What is the best way to trigger click events within a select dropdown using Angular?

I have implemented two buttons (month, year) that trigger different events. Now, I want to replace these buttons with a select element. Can you guide me on how to achieve this? Here is my current code: // Button implementation <button class="menu-butt ...

The logo emerges from the background color, with the text consistently appearing in black

In my attempt to display a logo and text together in an Outlook page, I encountered an issue. The content from the HTML page appears different when sent to MS Outlook. Despite not using flexbox in my HTML code, Outlook interprets it differently. I am uncer ...

Struggling to align radio buttons correctly within the form. The goal is to have them match the alignment of the other text boxes in the form

I have been struggling with aligning radio buttons to match the alignment of the form's text boxes. I've experimented with various solutions recommended on this site, as well as others and YouTube. However, the most helpful resource I found was: ...

Steps to switch the displayed ionicon when the menu is toggled

My goal is to display the 'menu-outline' ionicon on my website until it is clicked, at which point the icon will change to 'close-outline' and vice versa. I am utilizing jQuery for this functionality. Although I am aware of how to togg ...

Is it possible to use AngularJS to show additional information between rows when a table row is clicked in HTML

I'm currently working on an html table where the <tbody> is generated using angular's ng-repeat. Take a look at my html: <tbody ng-repeat="car in carList | filter:tableFilter"> <tr> <td><a target="_blank" h ...

How to Center a Button in a Menu Using CSS

I've been struggling for a while now trying to design a menu with standard buttons on the left and a single button on the right. I've experimented with various techniques using ul li and applying styles like float, but nothing seems to work! No m ...

How can I automatically add a specific word that I've highlighted within a <text area> situated within an iframe?

This chrome plugin automatically inserts a designated word into the content of an iframe. Specifically designed for Chrome users. <html> <iframe id="iframe" frameborder="0" src="http://www.maozakor.co.il/demo/default.aspx"> </if ...

How to intercept a post request from JavaScript in a JavaFX WebView

Exploring JavaFX for the first time has brought me to the intriguing WebView class. I am interested in using it to locally host an HTML5 site as the front end for a desktop application. I have a question regarding ajax requests made from JavaScript within ...

Identify compatibility with the background-attachment property set to fixed

I've been searching for an updated answer on this topic, but I couldn't find one so I wanted to confirm. My goal is to achieve a parallax effect using background-attachment: fixed, however I've noticed that it doesn't work on mobile ph ...

Creating a Loop with JavaScript through a List

My current API response format is: "imagePath": "path1", Here is the JavaScript code I am using: <div className="flexAlignCenterJustifyCenter"> {event.imagePath ? ( <img src={event.imagePath} onErro ...

Please indicate the number of lines for the href within the span element

I'm struggling with formatting a <span> tag, specifically the .lastMessageLink class that contains an <a> element with the .lastMessageText class. The content within .lastMessageText can vary from just a few characters to a lengthy paragra ...

Building Effective Web Designs with Bootstrap and Semantic Grid System

There are several ways to effectively organize and maintain the Bootstrap Grid. For example: <div id='header'> <div class='row'> <div class='col-md-6 header-left'> or <div id='header&ap ...

Update the carousel markers to circular shapes in Bootstarp 5

I have been searching for a solution to change Carousel indicators from rectangles to circles in Stackoverflow, but all the available solutions are for Bootstrap 4. Is there a way to achieve this? Here is what I attempted: .carousel-indicators [data-bs-ta ...

Avoiding overlapping of div elements in a stacked div layout

I have a challenge with creating a vertical layout of stacked divs. Everything was going smoothly until I encountered the #resume div, which stubbornly stays hidden beneath the table-containing div above it. Despite trying various adjustments to float and ...

What methods can I use to prevent a user from accidentally double clicking a link within an email?

After users request a password reset, they are sent an email containing a link to create a password reset code. This link remains valid for 24 hours and can be utilized multiple times within that time frame to generate new codes in case the initial one is ...