Skip to main content

How To Make Ordered Sub-list in CSS/HTML

Combination <ol> and <li> tags generate numbered list in HTML document, but it does not support numbered sub-list default. By adding 3 lines of CSS scripts, we can generate the numbered and ordered sub-list. The idea is from li:bofore style.
ol { counter-reset: item }
li { display: block ;font-weight:bold}
li:before { content: counters(item, ".") " "; counter-increment: item }
And Nested <ol><li> HTML tags generate the list.
<ol>
  <li>Item 1</li>
  <li>Item 2
    <ol><li>Item 2.1</li>
           <li>Item 2.2</li>
           <li>Item 2.3
              <ol><li>Item 2.3.1</li>
              </ol>
           </li>
    </ol>
  </li>
  <li>Item 3</li>
</ol>
The result page shows:
  1. Item 1
  2. Item 2
    1. Item 2.1
    2. Item 2.2
    3. Item 2.3
      1. Item 2.3.1
  3. Item 3
If you want insert unordered list(<ul><li>) into the <li> tag in <ol>tag, just add following lines in your CSS script.
ul li:before {content:"- ";} // some symbols you want.

Comments

Post a Comment

Popular posts from this blog

Google's Favorite Colors By Hex Codes (With New Google Logo)

Google keeps its color scheme cross their products. Of course, each uses different colors but it keeps the main philosophy. I heard that the test period for new Google logo was more than one year. It may the reason that the colors are comfortable to look. Sometimes, I copy the colors for designing my blogs and web sites. Copyright? oh..

Color Conversion: RGB to HEX , HEX to RGB

Color conversion between RGB and Hex is needed sometimes even though HTML and CSS accepts both RGB and HEX codes for set color scheme of HTML elements. The conversion algorithm is simple. Then numbers in RGB format is decimal number and one in HEX code is hexadecimal number. For example, rgb(50, 100, 250) is same in HEX #3264FA: 50-32 | 100-64 | 250-FA.

Why Blogger Mobile Template Not Work?

Google Blogger shows blog pages with mobile CSS on mobile devices unless you change it disabled. You can see next figure by clicking mobile setting button on Template page. Since I want to change CSS and I remember there are some CSS elements starting with '.mobile', I open the template editor and edit as I want. And open my blog in my smart phone. Nothing changed.