Is there a way to place an image in front of every item in an inline list?

I am working on creating an inline list that shows an image before each list item. However, I am facing an issue where the image appears above the list item instead of being on the same line.

My goal is to have the image displayed to the left of each item, in line with the text so it acts like a bullet or space between items.

Here is what my current attempt looks like ... https://i.sstatic.net/Ncn1q.png

Markup:

    <ul class="list-inline">
      <li class="list-inline-item"><h4>Item One</h4></li>
      <li class="list-inline-item"><h4>Item Two</h4></li>
      <li class="list-inline-item"><h4>Item Three</h4></li>
    </ul>

Css:

ul li::before { 
content: url("~@/assets/asset-1.png");
display:inline-block
}

Currently, I am utilizing Bootstrap 4 and its classes to create this inline list.

Answer №1

Temani Afif pointed out that the h4 definition is missing in the css.

CSS:

ul li h4::before { 
  content: url("~@/assets/asset-1.png");
  display:inline-block
}

If you're curious, FlexBox makes this task simple and enjoyable!

This website is a fantastic resource for FlexBox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

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

Looking for ways to track active sessions in Laravel cache. Open to suggestions!

Struggling with a persistent issue for days now, I am seeking help to find a solution. In my Laravel application, I am aiming to track and display the number of online users. I have successfully integrated a feature in my admin panel to show the online an ...

downloading responsive design

Using media queries to define backgrounds with separate images based on browser size: @media (min-width:1440px){div.container{background:URL('bg1440.png');}} @media (min-width:960px){div.container{background:URL('bg960.png');}} @media ...

The size of the image remains constant, unaffected by the size of the surrounding div container or window

Having some trouble getting my images in the sidebar to resize with the container or window. Whenever I adjust the window size, the image ends up below the middle area. Check out a preview of my website here body{ background: grey } #container{ width: 1 ...

Chrome does not recognize the inline CSS for linear gradient applied to an HTML.ActionLink button

I attempted to incorporate a gradient background color into my action link button: <p>@Html.ActionLink("Call Cell Phone", "Call", new { id = Model.Id, number = Model.CellNumber }, new { @class = "btn btn-default", @style = "background-color:-webkit- ...

center the view on the specified element

Utilizing ReactJs, I am developing a horizontal timeline that showcases dates. For instance, there is a list of 100 elements, each containing a date and text content. The dates are displayed horizontally using flex-direction="row" and overflowX ...

Ways to determine if a Less file matches the compiled CSS file

Recently, I inherited a website that utilizes LESS for CSS pre-processing. My task involves updating certain styles; however, I am uncertain whether the former developers made changes to the LESS files and then compiled the CSS, or if they simply edited th ...

My presentations are not functioning as expected, could there be a problem with my HTML, CSS, or JavaScript coding?

My website utilizes a Slideshow feature to display images for blog posts. Recently, I attempted to include multiple slideshows within an article, which unfortunately caused all of the slideshows to malfunction. As it stands now, when the code is executed, ...

Using VueJS transitions may require the use of setTimeout for them to work

My code successfully slides out a menu: Vue.set(this.filterStyles, filterIndex, { display: "block", height: "auto", }); let filterValuesElHeight; Vue.nextTick().then(() => { let filterValuesEl = document ...

Adding text over an image in Tailwind without the need for absolute positioning is achievable

I'm struggling to position text over an image without using absolute positioning. It's working fine on large and small screens, but I'm having trouble with medium screens. I've searched for similar questions on Stack Overflow, but none ...

explore the route with the help of jquery scrolling feature

Is there a way to implement scrolling functionality for tab headers similar to this demo? I have a list of elements within a div that I need to scroll like the tabs in the demo. I attempted to achieve this by setting the position of the inner elements to ...

Transform this color matching game into an image matching game using JavaScript and jQuery

I have a color matching game that I would like to enhance by matching background-images instead of just background-colors. However, I am facing difficulties in making this change. For instance, instead of matching the color red with the text "red," I wan ...

Is it possible for a scrollable div to fill the space above a BottomNavigation bar?

My current project involves creating a fixed bottom navigation bar, with a scrollable div above it displaying various card lists. In my attempts to achieve this layout, I consulted both the Material-UI documentation here and here. However, I struggled to ...

How can I create a design that blends half image and half color together with intricate cutting techniques?

Can someone give me tips on creating a design like this? I attempted to use bootstrap to create it, but I was unsuccessful due to my lack of knowledge on how to achieve this specific background. Any guidance on the proper way to design it would be greatly ...

Why does the checked pseudo class seem to be unresponsive?

I have been attempting to customize the appearance of radio buttons, but I am encountering issues with the checked pseudo-class. Interestingly, the hover effect is working perfectly. Although this is just a small section of a larger form, I am focusing o ...

Angular Material Spinner with Custom Image Icons - (mat-spinner)

I have successfully implemented the mat-spinner in my project with configurable changes like color and mode of spinning. However, I am now looking to add an image icon, specifically the logo of a brand or company, inside the spinner. How can I achieve this ...

How can you create a unique custom border for an image and display it on another image?

I am working towards achieving a specific output similar to the one shown in this https://i.stack.imgur.com/ejiYC.png image. Currently, I have successfully created the border section. Now, my next challenge is how to overlap images and apply borders as de ...

Attempting to align content in the middle of the page across all web browsers

I need assistance with centering all the content on my website across different screen sizes and browsers. Currently, everything appears off-center and aligned to the left on various screens I have tested. You can view the HTML and CSS code in this link. H ...

The top-center alignment in Toaster (ngx-toastr) is missing a top margin

I recently started using the ngx-toastr library in my project. I have a message service that displays error messages at the top-center of the screen with the following code: @Injectable() export class MessageService { constructor(private toastrServic ...

Certain Nativewind designs are functioning improperly on native Android platforms, yet they operate correctly on the web

Utilizing Tailwind (Nativewind) with Solito in expo React Native, I have a styled component with children. While the style is correctly applied on the web version, only certain styles work in the native app. The `gap` and `text-center` classes do not work, ...

What is the best way to center a rotated element and have it aligned to the top?

* { box-sizing: border-box; } body { font-family: 'Poppins', sans-serif; margin: 0px; } .we-adopt { background-color: #8a8484; color: #ffffff; padding: 88px 0px; height: 100px; } .we-adopt-list span { display: i ...