Swapping out bullet points for delicious food icons in an unordered list on an HTML page

I am working with the following code snippet:

<div id="instructions">
   <h3>Get it done</h3>
   <ol>
      <li>In a blender add the eggs, chocolate powder, butter, flour, sugar and milk.</li>
      <li>Then whisk for 5 minutes</li>
      <li>Add the yeast and mix with a spatula gently.</li>
      <li>In a greased pan, pour the dough and bake in a medium oven (180 ºC) preheated for about 40 minutes.</li>
      <li>Don't forget to use a tall form for this recipe: as it takes two spoons of yeast, it grows a lot! Another solution may be to place just one spoon of yeast and keep your recipe in a small form.</li>
   </ol>
</div>

How can I replace the bullet points in the list with symbols like "egg", "timer", "mixer", and "oven"?

Answer №1

To add some flair to your list items, you have a few options. You can either use emojis with the list-style-type property or insert images using the list-style-image property. Another creative approach is to hide the default list style by setting list-style-type to none and then adding your desired image using a before pseudo-element.

ol li:first-of-type {
  list-style-type: "🥚 ";
}

ol li:nth-of-type(2) {
  list-style-image: url("https://loremicon.com/grad/15/15/98708662/png");
}
<div id="instructions">
  <h3>Get it done</h3>
  <ol>
    <li>In a blender add the eggs, chocolate powder, butter, flour, sugar and milk.
    </li>
    <li>Then whisk for 5 minutes</li>
    <li>Add the yeast and mix with a spatula gently.</li>
    <li>In a greased pan, pour the dough and bake in a medium oven (180 ºC) preheated for about 40 minutes.</li>
    <li>Don't forget to use a tall form for this recipe: as it takes two spoons of yeast, it grows a lot! Another solution may be to place just one spoon of yeast and keep your recipe in a small form.</li>
  </ol>
</div>

Answer №2

Unsure of the exact location you want to retrieve the images from, but I have included a recommended source.

<!DOCTYPE html><html lang="en"><head><title> Sample Page </title>
<meta charset="UTF-8>
<meta name="viewport" content="width-device-width,initial-scale=1.0,user-scalable=yes"/>
<!-- Source: https://stackoverflow.com/questions/62432014/how-to-replace-bullet-points-with-food-icons-on-an-unordered-list-in-html -->
<style>
ul { list-style-type: none; cursor: pointer; }
</style>

<!-- Images obtained from: https://getemoji.com/#food-drink -->
</head><body>
<div id="instructions">
  <h3>Get it done</h3>
  <ol>
    <li>In a blender, mix the 
      <ul>
        <li> 🍳 eggs, </li>
        <li> chocolate powder, </li>
        <li> 🧈 butter, </li>
        <li> flour, </li>
        <li> sugar, and </li>
        <li> 🥛 milk.</li>
      </ul>
    </li>
    <li> 🥣 Then whisk for 5 minutes</li>
    <li>Add the yeast and gently mix with a spatula.</li>
    <li>Pour the dough into a greased pan and bake in a preheated medium oven (180 ºC) for about 40 minutes.</li>
    <li>Remember to use a tall form as this recipe requires two spoons of yeast,
 it rises significantly! Alternatively, you can use just one spoon of yeast and bake in a smaller form.</li>
  </ol>
</div>
</body></html>

Answer №3

I believe this solution will be beneficial to you.

ol {
  list-style: none;
  padding: 0;
}

li.egg::before {
  content: url(your_image_url);
}

Answer №4

One creative approach is to eliminate the default CSS styling of an unordered list and replace it with an image or icon.

ol.food{
  list-style: none;
}

ol.food li:before {
  display: inline-block;
  margin-left: -20px;
  padding-right: 5px;
  width: 15px;
  
  /* Here you can place the food icon or image you want */
  content: "\f00c"; 
  font-family: FontAwesome;
  
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<div id="instructions">
   <h3>Get it done</h3>
   <ol class="food">
      <li class="egg">In a blender add the eggs, chocolate powder, butter, flour, sugar and milk.</li>
      <li class="timer">Then whisk for 5 minutes</li>
      <li class="mixer">Add the yeast and mix with a spatula gently.</li>
      <li class="oven">In a greased pan, pour the dough and bake in a medium oven (180 ºC) preheated for about 40 minutes.</li>
      <li class="spoon">Don't forget to use a tall form for this recipe: as it takes two spoons of yeast, it grows a lot! Another solution may be to place just one spoon of yeast and keep your recipe in a small form.</li>
   </ol>
</div>

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

Utilizing Angular to integrate with an external API

I have encountered an issue while trying to connect to the Expedia API. In order to do so, I need an API key and ID. Initially, I utilized JSONP for this connection but ran into a bug causing problems. Additionally, storing my API key in JavaScript poses ...

Is anyone else experiencing issues with the jQuery slide-in not working on a particular website? How can I determine which version of jQuery is compatible with this site?

Essentially, I am looking to have a div box slide in on the page as it loads. This method has worked successfully on other websites and HTML previews that I have tested it on so far. However, for some reason, it does not seem to work on this specific websi ...

What steps do I need to take to create npm packages specifically for react-native development?

Which programming languages are essential for creating npm packages that work on both android and ios platforms in react-native development? Can you suggest any helpful documentation or blogs for developing npm packages that support ...

What options are available for managing state in angularjs, similar to Redux?

Currently, I'm involved in an extensive project where we are developing a highly interactive Dashboard. This platform allows users to visualize and analyze various data sets through charts, tables, and more. In order to enhance user experience, we ha ...

Form Input Field with Real-Time JavaScript Validation

Is there a way to validate the content of a textarea using pure JavaScript, without using jQuery? I need assistance with this issue. <script> function validate() { // 1. Only allow alphanumeric characters, dash(-), comma(,) and no spaces ...

Loading external templates in Angular2 with Webpack2

Attempting to integrate ngtemplate-loader in a project using AngularJs 2 and Webpack 2 is proving challenging. While this setup has been successful in Angular 1.x projects with Webpack 1.x, it encounters an error when running in the browser: Uncaught Type ...

What are the best strategies for creating HTML website designs that are both scalable, adaptable, and versatile?

As a beginner in HTML website design, I have recently started using HTML, CSS, jQuery, and JavaScript for designing websites. After creating a site with almost forty webpages, the client requirements are changing, requiring changes to be made across all ...

Search in the Firestore database for documents that have a field containing a reference to another document. Once those results are found, use the reference to conduct a second query

In an attempt to optimize the query that delivers details of all events a participant has attended, I have restructured my database schema. Events with participants are now linked through a subEvent subcollection in the users collection, storing document r ...

Animate the transition effect as soon as the block is displayed

Looking to create a smooth page transition using CSS changes with the help of Javascript (jQuery). Initially, one of the pages is set to display none. page1 = $('.page1'); page2 = $('.page2'); page1.removeClass('animate').cs ...

Issue with Quantity Box not displaying values in Shopify store

I am currently seeking assistance with resolving an issue I have encountered on a Shopify theme that I recently customized. The problem lies within the quantity box on the live site where despite being able to adjust the quantity using the buttons, the act ...

Tips for transferring data between two forms in separate iFrames

I'm trying to achieve a functionality where the data entered in one form can be submitted to another form within an iframe. The idea is to allow visitors to preview their selected car in the iframe, and if satisfied, simply press save on the first for ...

What could be the reason for the HTML canvas not displaying anything after a new element is added?

How come the HTML canvas stops showing anything after adding a new element? Here is my HTML canvas, which works perfectly fine until I add a new element to the DOM: <canvas class="id-canvas", width="1025", height="600"> ...

Tips for creating a multitude of components

I have my react code in a single component and I am wondering how to split it into two components for the images container and showroom images. import React, { Component } from 'react'; export default class App extends Component { render() { ...

Using the onreadystatechange method is the preferred way to activate a XMLHttpRequest, as I am unable to trigger it using other methods

I have a table in my HTML that contains names, and I want to implement a feature where clicking on a name will trigger an 'Alert' popup with additional details about the person. To achieve this, I am planning to use XMLHttpRequest to send the nam ...

As the user types, automatically format the input field for a seamless and intuitive experience

My current application is running on Angular 1.3.10 I have implemented a jQuery function to automatically add a backslash to the expiration input field once the user types the third number. Although it was a quick fix, I now aim to move this functionality ...

Adding a type declaration to the severity property in React Alert - A guide to Typescript

I've developed a type declaration object for the incoming data, but no matter what I try to define as the type for the property "severity", it's not happy. The options it wants (as displayed below) don't seem feasible. I'm curious if th ...

Implementing a vertical divider line in between columns with Foundation CSS

Here is the HTML code snippet: <link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.0/css/foundation.min.css" rel="stylesheet"/> <div class="card"> <div class="card-section"> <section class="row"&g ...

Prevent a specific folder from being included in expressjs routing

When using my expressjs app, I load public assets like this: app.use(express.static(__dirname + '/public')); Afterwards, I redirect all requests to the index, where every path is handled by Backbone app.get('*', routes.index); I am ...

Numerous applications of a singular shop within a single webpage

I have a store that uses a fetch function to retrieve graph data from my server using the asyncAction method provided by mobx-utils. The code for the store looks like this: class GraphStore { @observable public loading: boolean; @observable ...

Error Encountered During Building Apache Cordova Project in Visual Studio 2015

Encountering an issue when attempting to launch my cordova project on both an android device and android emulators. Currently utilizing visual studio 2015 In dire need of assistance! Error can be viewed in the image below: ...