Display a series of rows and columns showcasing various icons using CSS styling

I am looking to create a unique layout where a list of elements (ul with text) appears in a row, with each element having an icon or image displayed to its left. For inspiration, you can view an example at this link: list row columns with different icons in css

My primary challenge lies in incorporating the images or icons. I am struggling to figure out how to assign a distinct image or icon to each element (text).

Answer №1

To include the icon/image in the list element, you can follow these steps:

<ul>
  <li><img src="icon3.png" alt="icon" /> Text beside the icon</li>
  <li><img src="icon4.png" alt="icon" /> Text beside the icon</li>
</ul>

Alternatively, if you're utilizing an icon font such as Material Icons, you have this option:

<ul>
  <li><i class="material-icons">desktop_windows</i> Text next to icon</li>
  <li><i class="material-icons">phone_iphone</i> Text next to icon</li>
</ul>

Answer №2

Agreeing with Lauri, achieving your goal without frameworks is possible through the use of pure CSS.

<style>
    ul {
        padding: 0;
    }

    li {
        padding: 0.15em 0 0.5em 1.5em;
        margin-bottom: 0.2em;
        text-indent: 0.4em;
        font-weight: bold;
        list-style: none;
        background-repeat: no-repeat;
        background-size: 10px;
        background-image: url("https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR_DztL2nlERHrDWBFIyA5dp9sblqn6zt57uoRB4IbAbymgpFskfg");
    }
</style>

<ul>
    <li>Text</li>
    <li>Text</li>
</ul>

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

Place a locator on the variable at the identical level

My objective is to locate an element with both an id and a class. I achieve this using the following code snippet: return element(by.css('#right.closed')).isPresent(); While this method works correctly, I am looking to enhance it by introducing ...

Struggling to understand the Bootstrap col-xs-8 grid system

I am trying to customize my sign-in box to only occupy 8 columns out of the available Bootstrap grid. Here's the code snippet I have so far: <div class="shadow bg-white rounded col-lg-5 col-md-5 col-sm-6 col-xs-8 tile"> However, the output is ...

Why won't my code work with a jQuery selector?

I'm struggling to retrieve the value from a dynamically generated <div> using jQuery. It seems like the syntax I'm using doesn't recognize the div with an id tag. The HTML code is stored in a variable, and below is a snippet of code w ...

What could be causing the overlap between my section and header on the website? Any suggestions on how to resolve

I've been working on my website and I'm having an issue with the header overlapping. I used float left for my navigation bar, but when I try to add a showcase below it, the showcase only overlaps the header section. The aim is to have a navigatio ...

What is causing jQuery toggleClass to fail in removing a class?

I have successfully implemented a Skills accordion feature, but I am now trying to add a button that toggles all the skill sections at once. However, I am facing issues with jQuery not correctly adding or removing classes on the .accordion-trigger-all elem ...

Why does the variable in throw new exception print instead of the variable value being printed?

<div style="text-align: left;"> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"> Name:<input type="text" name="name"><br> Age:<input type="text" name="age"> <br> ...

What is the method for transforming latitude and longitude coordinates into a physical address for a website?

I'm working with an API that provides latitude and longitude coordinates, and I need to retrieve the address information (city, area, etc.) based on these values. For example, there is a website like where if we enter the IP address of a location, i ...

Show the flex items arranged horizontally

This template is generated dynamically by Django: <div class="center row"> <h3><span>The Core</span></h3> {% for member in core %} <a class="core_img " href="#"> <div class="img__overlay"> ...

What is the best way to send a variable to a URL when a link is clicked?

Recently, I started learning PHP and ran into a challenge while working on a school project. The specific issue that I'm facing is how to pass variables to a URL when a link is clicked. Essentially, my problem involves a dropdown menu displaying diffe ...

Add the application's logo image to the Ionic header along with a side menu

When attempting to place the app logo image in the center or left of the Ionic header with vertical alignment, it seems to shift to the top instead. The code I am currently using to display the logo is causing some issues: <ion-view view-title="<im ...

The Drop-down menu with carousel in Bootstrap is experiencing difficulties displaying its sub-menu items

I am currently facing an issue where the sub-menu items are hidden behind the content in a bootstrap carousel. Despite everything else working fine, this particular problem is causing a headache. JSFiddle: https://jsfiddle.net/Saneesh/pwmyvsw6/65/ Is th ...

What is the best way to execute a Java program from a PHP webpage after submitting a form?

I have a .php page where I am trying to run a Java program in the backend after submitting a form. I have attempted using exec() and system() functions, but unfortunately it is not working as expected. Can someone please provide assistance with this issue? ...

What are the steps to resize a YouTube embedded video?

I am currently attempting to use a YouTube video as the background for breadcrumbs on my website. However, I am facing an issue with setting the video width to cover the full screen. The image below shows that the video is displayed in the center of the if ...

Steps to establish a maximum font size for my buttons

I've been working on creating buttons to decrease and increase the font size of my text. The functionality is there, but I want to establish a limit on how small or large the font can go. Here's what my current code looks like: <md-button ng ...

Guide on displaying a welcoming error notification within a Bootstrap modal form

How can I display an error message within a modal after clicking on the update button? In this example, I have included a required attribute on the input field. I would like to modify the error message based on recommendations from Form Validation Best Pr ...

Enhancing React Flow to provide updated selection and hover functionality

After diving into react flow, I found it to be quite user-friendly. However, I've hit a roadblock while attempting to update the styles of a selected node. My current workaround involves using useState to modify the style object for a specific Id. Is ...

How can I make the Bootstrap 4 checkbox/switch control smaller using the -sm class?

When using BS4, it is possible to add a custom switch/checkbox to a form. However, the small (-sm) modification does not seem to work. I have included a code sample and an image for reference. https://i.sstatic.net/8bhKz.png My goal is to make the switch ...

Combining shared table rows with embedded ruby code in Javascript - is it possible?

I'm a new Javascript learner and I'm attempting to create a function that will merge rows with the same value (year in this case) and add their numbers together. Although my code isn't functioning as expected, it also doesn't seem to be ...

Clearing a database table in MySql by clicking an HTML button

I have a simple requirement for my website - I need to create a button that, when clicked, will truncate a database table. Unfortunately, I have been unable to do this successfully on my own. Can someone please help me with this task? Here is my attempt a ...

The topbar on Foundation seems to be malfunctioning - where did I go wrong?

I am trying to implement the Topbar feature of Foundation for my website's navigation. However, all I see is a plain bulleted list with no formatting whatsoever. Currently, I have only included basic external dependencies like jQuery and Foundation in ...