The line directly following the first line within the <li> element is located in the same position

I need help with customizing the bullet background-image for an <li> element. I want the text in the bullet to be displayed outside the marker using the CSS property list-item-position: outside. However, my current implementation doesn't seem to be working as expected. The second line of text still starts at the beginning of the container, under the image. Here is the HTML code I'm using:

<ul className={styles.missieTxt}>
          <li className={styles.bulletsMissie}>
            ... lorem ipsum lorem ipsum lorem, {" "}
            <span className={styles.focusMissie}>100% </span>lorem
          </li>>
        
               <li className={styles.bulletsMissie}>
            ... lorem ipsum <span className={styles.focusMissie}>lorem</span>
            , lorem ipsum lorem ipsum
          </li>

          <li className={styles.bulletsMissie}>
            ... <span className={styles.focusMissie}>lorem</span> lorem ipsum
            <span className={styles.focusMissie}>lorem</span> 
          </li>>

          
        </ul>

Here is the corresponding CSS:

.missieTxt {
  display: flex;
  flex-direction: column;
}

.bulletsMissie {
  list-style-type: none;
  position: relative;
  font-size: clamp(0.8rem, 1.3vw, 1.5rem);
  margin-right: 1rem;
  list-style-position: outside;
}

.bulletsMissie::before {
  content: "";
  display: inline-flex;
  height: 20px;
  width: clamp(25px, 3vw, 48px);
  background-image: url(../images/overOns/bulletsImg.png);
  background-repeat: no-repeat;
  background-size: 100%;
  align-items: center;
  margin-right: 0.5rem;

}
.focusMissie {
  color: #78c0a8;
  font-weight: bold;
}

When the screen size is reduced and the text overflows to the next line, it starts below the image rather than where I want it to be. Can anyone provide a solution to this issue? Thank you!

Answer №1

Give this a try to see if it functions.

.missionText {
      display: flex;
      flex-direction: column;
    }
    
    .bulletPointsMission {
      list-style-type: none;
      position: relative;
      font-size: clamp(0.8rem, 1.3vw, 1.5rem);
      margin-right: 1rem;
      list-style-position: outside;
      display: block;
      padding-left: clamp(25px, 3vw, 48px);
    }
    
    .bulletPointsMission::before {
      content: "";
      display: block;
      position: absolute;
      left: 0;
      top: 0;
      height: 20px;
      width: clamp(25px, 3vw, 48px);
      background-image: url(../images/aboutUs/bulletPointsImg.png);
      background-repeat: no-repeat;
      background-size: 100%;
    
    }
    .highlightMission {
      color: #78c0a8;
      font-weight: bold;
    }

Answer №2

If you're looking to make adjustments, think about switching: list-style-type: none;

within .bulletMission

to

list-style-image: url(../images/aboutUs/bulletImage.png);

Adding list-item-position: outside should do the trick.

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

Troubleshooting problem with CSS hover effect on background images

Can anyone assist me with creating a simple mouse hover effect on these two images? I am having trouble getting it to work. I am looking for a fade transition to occur when the mouse is over the images. Thank you in advance! * { padding: 0; margin: ...

Angular static dropdown option

<input [formControl]="twitterHandle" id="twitterHandle" placeholder="twitterHandle"> Fetching the input value from the Twitter handle input field using the following code: twitterHandle = new FormControl(); this.twitterHandle.value; Similarly, if ...

A guide on extracting data from a Script element in an HTML file and saving it to a CSV file using Python Selenium

Looking for help with optimizing a Python script that extracts data from the Script tag on an HTML web page. The current output saved in a CSV file is not meeting my requirements: (1) the format is incorrect, and (2) there is unnecessary content included. ...

How to Align HTML Menu in the Middle of the Page

I've been struggling to center my menu on the page. I tried setting the display to block and using margin auto for left and right, but it's not working as expected. You can see the issue in this JSFiddle. Any help would be appreciated. <ul id ...

Is there a way in Angular2 to append a class name from a variable to the host element without removing the current classes?

I am facing a challenge where I have a class name stored in a variable and I need to apply it to the host element of my Angular2 component. However, I am struggling to find a solution for this. While I can easily add a constant string as a class using Hos ...

The sliding div unites with the bottom button, rather than the top one

When hovering over the upper left button, a div with sample description slides down. However, I am facing two challenges that I cannot seem to resolve. The description is supposed to merge with the second button but instead merges with the first one. I a ...

How do I set up a navigation bar item to align to either side based on the selected language?

I need to adjust the positioning of the last list item component within a specific div. The webpage is available in both Arabic and English, with the direction changing based on the selected language. Here is a snippet of CSS code that I'm using: #na ...

When seen on a mobile device, the background image is set to repeat along the

Having trouble getting my background image to repeat on the y-axis when viewed on a mobile device. On desktop, the page doesn't scroll and the background image fills the screen perfectly. However, when switching to tablet or mobile, scrolling is neces ...

Scrolling inside a DIV with fixed positioning

Can you help me with a question? I've been using the jScrollPane plugin and I absolutely love it. However, I'm struggling to retrieve the top position of a div on the page while scrolling inside a jscrollpaned DIV. Using $(window).scroll(); works ...

Is there a way to ensure that spans are inline with a div?

My structure is pretty straightforward: <div></div><span></span><span></span> However, I'm looking to have them all appear on a single line. Currently, they are rendering like this: <div /> <span />&l ...

encountering a Zend Framework error

Looking for help with printing data after an inner join of two tables in table format. I encountered the following error in the code below: Parse error: syntax error, unexpected end of file in /home/bina/public_html/studentzend/application/views/scri ...

Using jQuery to compare input with the current select optgroup choices

I'm struggling with looping through options within a form select. The options are grouped into optgroups, and I believe this is where my issue lies as I can't seem to find the correct syntax. My objective is to compare the value entered using .v ...

Combining two HTML tables in PHP: A step-by-step guide

I have two HTML tables that each contain three rows and one column. I am looking to combine them programmatically in order to create a single table with two columns and three rows. Is there a specific function or workaround that can help me achieve this? ...

Issue with alignment of Bootstrap inline form field on top and bottom levels

I seem to be encountering an issue highlighted in the image below: My goal is to have the state dropdown perfectly aligned with the top and bottom edges of the other two controls. Here's the code snippet I've used to create this section of the i ...

Experiencing repeated triggering of ng-change on 'range' input in Chrome

When the range input is changed by sliding, the ng-change function continues to be triggered repeatedly until another element is clicked. This issue seems to occur only in the Chrome browser. You can view an example on this fiddle. Try sliding the element ...

My goal is to develop a PHP photo gallery using either an array, session variables, or cookies

I am in need of a solution for my issue. https://i.stack.imgur.com/Xe65l.png The image shows the front end, and I require a corresponding function to be developed for it. ...

CSS for Responsive Web Development: Adjusting the Height of Mobile Sliders

I've been working on adjusting the height of the slider on my website for mobile screens, but I can't seem to get it right. The website in question is www.msstoreway.com. Despite adding the CSS code below, I was able to adjust the slider height ...

Unable to get font-face to function properly on IE versions 7 and 8

I'm having trouble getting the font-face to work properly on both IE7 and IE8. This is the code snippet I have used: @font-face { font-family: 'DroidSans'; src: url('fonts/DroidSans.eot'); src: url('fonts/DroidSa ...

What is the best way to align elements in relation to a central div container?

Is there a way to align two buttons in the center on the same line, and then position a selector to the right of those centered buttons? How can I achieve this arrangement? Essentially, how do you position an element in relation to a centered div? UPDATE: ...

An intuitive guide on showcasing the dynamically generated variables' values with AngularJS

I am facing an issue with my HTML template code: <p>{{"fieldname_"+lang}}</p> Within the controller, I have defined the following: $scope.lang = "mr"; $scope.fieldname_mr = "Dynamic variable"; My expected result is Dynamic variable, however ...