• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Programming Expert

Solving All of Your Programming Headaches

  • HTML
  • JavaScript
  • jQuery
  • PHP
  • Python
  • SAS
  • Ruby
  • About
You are here: Home / HTML / How to Make an HTML List Without Bullets

How to Make an HTML List Without Bullets

March 10, 2022 Leave a Comment

There are a couple of ways we can make an HTML list without bullets. We can do it through CSS, or we can do it in HTML with the style attribute. Let’s look at the style attribute inside an HTML element.

<ul id="list1" style="list-style-type:none;">
  <li>Blue</li>
  <li>Green</li>
  <li>Orange</li>
  <li>Yellow</li>
</ul> 

As you can see in the code above, we can set the list-style-type property of the unordered list to none to make this HTML list not have bullet points.

The code above will display this:

  • Blue
  • Green
  • Orange
  • Yellow

We can also do this by setting the list-style-type property to none in a style tag. See how this is done below.

<style>#list1 { list-style-type:none; }</style>
<ul id="list1">
  <li>Blue</li>
  <li>Green</li>
  <li>Orange</li>
  <li>Yellow</li>
</ul> 

We prefer to have all our styles grouped together in a style tag, or in a separate CSS sheet, so we usually will go with the method above. But both examples will yield the same result.

Making an HTML List Without Bullets Using JavaScript

In this example, we will have an HTML list with bullet points to start. We will then provide a button for the user to remove the bullet points using JavaScript.

Here is the HTML code:

<p>Here is a list of some colors.</p>
<ul id="color-list">
  <li>Blue</li>
  <li>Green</li>
  <li>Orange</li>
  <li>Yellow</li>
  <li>Pink</li>
  <li>Red</li>
  <li>Black</li>
  <li>Purple</li>
  <li>White</li>
</ul> 
<div id="click-me" onclick="removeBulletPoints()">Remove bullets</div>

We will add an onclick event to our button so that we can run a function. In the function, we will simply target the unordered list using the getElementById() method, and remove its bullet points using JavaScript, the style attribute, and the list-style-type property. Here is the code below:

function removeBulletPoints(){
  document.getElementById("color-list").style.listStyleType = "none";
};

The final code and output for this example of how to make an HTML list without bullets using JavaScript is below:

Code Output:

Here is a list of some colors.

  • Blue
  • Green
  • Orange
  • Yellow
  • Pink
  • Red
  • Black
  • Purple
  • White
Remove bullets

Full Code:

<p>Here is a list of some colors.</p>
<ul id="color-list">
  <li>Blue</li>
  <li>Green</li>
  <li>Orange</li>
  <li>Yellow</li>
  <li>Pink</li>
  <li>Red</li>
  <li>Black</li>
  <li>Purple</li>
  <li>White</li>
</ul> 
<div id="click-me" onclick="removeBulletPoints()">Remove bullets</div>

<script>

function removeBulletPoints(){
  document.getElementById("color-list").style.listStyleType = "none";
};

</script>

Other Articles You'll Also Like:

  • 1.  How to Filter a List of Divs with a Text Input Bar Using Javascript
  • 2.  How to Give a Textarea a Max Length
  • 3.  HTML span width – Set the Width of a Span in HTML
  • 4.  What Type of HTML List will Automatically Place a Number in Front of the Items?
  • 5.  How to Make a Div Scrollable in HTML
  • 6.  HTML subscript – How to Lower Text in HTML
  • 7.  innerHTML vs outerHTML
  • 8.  outerHTML – How to Get and Change the outerHTML Property of an Element
  • 9.  Sort List of Divs with Data Attribute with Radio Buttons Using Javascript
  • 10.  What is the Correct HTML for Making a Text Input Field?

About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.

Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.

At the end of the day, we want to be able to just push a button and let the code do it’s magic.

You can read more about us on our about page.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About The Programming Expert

the programming expert main image

Welcome to The Programming Expert. We are a group of US-based programming professionals who have helped companies build, maintain, and improve everything from simple websites to large-scale projects.

We built The Programming Expert to help you solve your programming problems with useful coding methods and functions in various programming languages.

Search

Learn Coding from Experts on Udemy

Looking to boost your skills and learn how to become a programming expert?

Check out the links below to view Udemy courses for learning to program in the following languages:

Copyright © 2023 · The Programming Expert · About · Privacy Policy

x