Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9096449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:51:19+00:00 2026-06-16T23:51:19+00:00

How can I style list items like this? So some kind of colored square

  • 0

How can I style list items like this?

enter image description here

So some kind of colored square before the text. I was looking into this but couldn’t find it :

http://www.w3schools.com/cssref/pr_list-style-type.asp

They don’t have to be list items but it seemed to me convinient because it is some kind of list which I would like to style and display in the same line not in different lines like in image above.

I’ve tried this :

<ul class="ordering">
<li><div></div><span>One</span></li>
<li><div></div><span>Two</span></li>
<li><div></div><span>Three</span></li>
</ul>

and with this css :

.ordering {
    list-style:none;
    min-width:250px;
}
.ordering div{
         width: 12px; height: 12px; float: left;
    }
.ordering span{
        display: block;
        float: left;
        font-size: 11px;
        line-height: 11px;
        padding-left: 5px;
    }

The problem I encounter is that I can’t seperate them (they’re glued together), and the other one when I have many items which don’t fit in the size of ordering class they break line but the square remains in the previous line so square + text isn’t being treated as one part.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:51:20+00:00Added an answer on June 16, 2026 at 11:51 pm

    You have tried in the right way. Only additional thing is you can minimize the html structure and use nth-child() property

    HTML

    <ul class="ordering">
    <li><span></span>One</li>
    <li><span></span>Two</li>
    <li><span></span>Three</li>
    </ul>
    

    CSS

    ul.ordering {    list-style:none;   min-width:250px; }
    ul.ordering li{ 
      display:block; 
      clear:left; 
      vertical-align:middle;  
      font-size: 20px;
       line-height: 20px; 
      padding-left: 5px; }
    ul.ordering li span{  width: 12px; height: 12px; background:red;  display:inline-block; margin-right:6px }
    ul.ordering li:nth-child(2) span{ background:green !important;  }
    ul.ordering li:nth-child(3) span{ background:blue !important;  }
    

    LIVE DEMO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an unordered list of items, something like this, shortened for brevity: <div
This sounds like a (very) silly question but I just can't find a way
I'm trying to set up an accordian style list of tabs where I can
Just wondering if anyone has any ideas on how we can style templates... Like
I searched for this issue but can't find it... my problem is with this
This seems really simple, but I can't get the syntax correct w/ the following
My HTML looks like this: <div> <div style=display:inline-block; width: 200px;>Sidebar</div> <div style=display:inline-block;>Content</div> </div> My
What I would like to happen is to have a menu of list items
I am wanting to know if I can add some style to strings used
I am creating some kind of chat style application. The Listbox is getting filled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.