Styling each line of text with a decreasing background image using CSS

I was in the process of creating a pricing plan inspired by https://codepen.io/chaoticpotato/pen/zYEPRYG. However, I encountered an issue where when the text within each bullet point spans across multiple lines, it causes the text to shift slightly to the left with each line. As a result, the background image of the bullet point becomes partially obscured and loses visibility as the text extends to more lines.

<ul class="featureList">
          <li>2 links</li>
          <li>Own analytics platform</li>
          <li>Chat support</li>
          <li class="disabled">Mobile application</li>
          <li class="disabled">Unlimited users</li>
        </ul>
.featureList {
  --color: #000;
  --icon: var(--redTick);
  --height: 0.875rem;

  margin: 0 0 2.75rem;
  padding: 0;
  font-weight: 500;

  li {
    color: var(--color);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;

    &:before {
      content: "";
      background-image: var(--icon);
      background-size: cover;
      display: block;
      width: 1.125rem;
      height: var(--height);
    }

    &:last-child {
      margin-bottom: 0;
    }

    &.disabled {
      --color: #b1b8c9;
      --height: 1.125rem;
      --icon: var(--close);
    }
  }
}

Has anyone encountered this issue before? I've searched online for solutions but haven't found anything that works effectively yet.

Answer №1

According to @psdpainter's comment, the remedy involves including flex-shrink: 0 within .featureList li:before

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

Safari IOS presents a display issue when using fx-layout="column" for Flex layout

We are currently utilizing Angular for the front-end with fx-layout API for responsiveness. Whenever we employ fxLayout="column", all elements collapse and appear to have no height. What is the recommended approach when using fx-layout/flex to address th ...

Tips for updating the input field value when clicking on dynamically generated edit icons

Within this code, there is an ajax function that assigns values to fields, along with dynamically created edit icons. Each address added in the database generates a new edit icon. My requirement is to have each button alert its id value when clicked. Below ...

Creating a unique visual identity for the collapsing navbar with a dark theme

As a novice in the world of web design, I might be asking a simple question or posting in the wrong forum, so bear with me. In my static blog, I'm using Bootstrap 4 to streamline the design process. While I'm generally satisfied with how it looks ...

Currently, I am attempting to implement password strength validation using Angular

Looking for a way to implement password strength validation in Angular? You may encounter an error message like this: NullInjectorError: No provider for password strength! in the passwordstrength.ts file HTML <div class="validation_errors t ...

The mouse event listener fails to function in plain JavaScript

I've been tackling a fun little project from The Odin Project called "ETCH-A-SKETCH". The idea is to change the color of squares when the mouse hovers over them, but I'm having trouble getting the onmouseover event to trigger. Any idea what could ...

Maintain hover effect of main menu on sub-menu in CSS3 flip dropdown menu

Check out the fiddle I created for my query https://jsfiddle.net/e7te8hf1/ <section id="action-bar"> <div id="logo"> <a href="#"><img src="img/logo.png"></a> </div><!-- end logo --> <nav class="navbar navigat ...

If the value of the first input is zero, display "PAID" as the value of the second input. If the value of the first input is not zero, display "NOT PAID" as the value of the second input

When the value of the first input in HTML is 0, then display "PAID" as the value of the second input. If the value of the first input is not 0, then show "NOT PAID" as the value of the second input. <label>Balance Amount</label> / ...

Removing multiple texts from a div using jQuery

In my search results, I found sentences with multiple words at the beginning that are concatenated. <div itemprop="articleSection" class="entry-summary"> WHAT WE DOSource Integrate Support Manage Transform A metre-wide “lazy river” of cobbleston ...

providing the PIE.htc file from the developer server within Visual Studio 2010

Has anyone had success serving the developer server on Visual Studio 2010 with the PIE.htc file? Unfortunately, PIE.htc is not functioning properly when attempting to run my web application on the local developer server. Any suggestions or hints would be ...

Issue with Angular 6: Jquery unable to detect element when using *ngIf directive

I'm currently developing an app using Angular 6, and I am facing an issue while trying to add a class using the jquery hover() method. In my navigation menu, I have 5 links, and although they all appear the same, 2 of them have an added *ngIf directiv ...

What is the button description when it is hovered over?

I implemented a menu feature where hovering over a button displays its description in a DIV. The descriptions are stored in the 'data-desc' attribute of each button. <ul id="menu"> <li><a href="page" data-desc="Page descriptio ...

Images in the JavaScript menu are not remaining fixed in place

Can someone help me with my website? I'm having trouble with the menu for different pages, it should stay gray for the active page. It was working fine before I switched to Wordpress, but now I'm not sure what the issue is. Could someone take a ...

Exploring simpleML's capability to delve deeper into the depths of the page source

I've been able to successfully extract the username babesmcphee from reading this site using simpleML in processing. However, I'm facing an issue with retrieving the second username (JohnCMayer) and subsequent ones. I suspect the problem lies in ...

Creating a secure and efficient method for PHP database interaction in the login/register modal

Currently, I am in the process of revamping a login page to combine both the login and register forms onto a single page instead of having them on separate pages. In my previous setup, both the login and register pages were able to access my database corre ...

Adjusting the input label to be aligned inside the input box and positioned to the right side

I am currently working on aligning my input label inside the input box and positioning it to float right. The input boxes I am using have been extended from b4. Currently, this is how it appears (see arrow for desired alignment): https://i.stack.imgur.co ...

Creating a custom front page in WordPress with a custom post type post

After using the CPT UI plugin in WordPress to create a custom post type, I am now facing the issue of not being able to display these posts on the front page by setting the 'reading' option in the admin panel. How can I go about displaying them p ...

Seeking assistance with implementing Styles using the .css() function in Jquery. Any guidance is appreciated

This particular style is exactly what I am looking for. body{ background: url("img/Background_Home.jpg") no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; ...

What could be causing the video to extend beyond the limits of the container?

When extending the result window, the video ends up overlapping the section below it. I am looking to keep the video within the confines of the section's height, which is set to height:100vh. Is there a way to accomplish this? Check out this jsFiddl ...

Learn how to create a button that will only submit a value when clicked using Node.js and EJS

Currently in my ejs file, I have a button that sends a value to app.js instantly when the program runs. However, I want it to only submit the value when clicked by the user. <% notesArray.forEach((note,i) =>{ %> <div class="note"> ...

Angular 8: ISSUE TypeError: Unable to access the 'invalid' property of an undefined variable

Can someone please explain the meaning of this error message? I'm new to Angular and currently using Angular 8. This error is appearing on my console. ERROR TypeError: Cannot read property 'invalid' of undefined at Object.eval [as updat ...