Creating a fake ordered list - html

I have a site which lists the line of succession to the British crown. As the line of succession is an ordered list, the main part of the site is in an <ol>.
However, there's a wrinkle. People occasionally drop out of the line of succession (most commonly for marrying a Catholic). For example, see Prince Michael of Kent is listed as 16th in line on 1978-06-29, but the next day he has vanished from the list as he married a Catholic on that date.
Currently, as you see, I just drop people from the list when they are excluded from the succession. But actually, I'd like to include them, but use a "dimmed" typeface for their entries in the list. But that gives me another problem. I can then no longer use an ordered list as excluded people don't have a position in the succession. So I need to omit the number from some items in an ordered list.
So I'm looking for the best approach to simulate an ordered list, but with the ability to omit the numbers on some list items. I have a few ideas:
Switch to a <ul> and add my own numbers. Can I style it to remove the bullets and outdent the numbers?
Switch to just using outdented paragraphs.
Use a table with a very narrow first column.
But I wonder if there's a CSS and/or HTML trick that I'm missing. Is there any easier way to achieve what I'm looking for?
Update: The current HTML looks like this:
<ol>
<li itemscope itemtype="http://schema.org/Person"><span itemprop="name">The Prince Charles, Prince of Wales</span>
<br><span class="small">Age 69
(born <a title="Line of Succession on 14 November 1948" href="/1948-11-14">14 November 1948</a>),
<br>Son of the sovereign</span></li>
<li itemscope itemtype="http://schema.org/Person"><span itemprop="name">Prince William, Duke of Cambridge</span>
<br><span class="small">Age 35
(born <a title="Line of Succession on 21 June 1982" href="/1982-06-21">21 June 1982</a>),
<br>Grandson of the sovereign</span></li>
<li itemscope itemtype="http://schema.org/Person"><span itemprop="name">Prince George of Cambridge</span>
<br><span class="small">Age 4
(born <a title="Line of Succession on 22 July 2013" href="/2013-07-22">22 July 2013</a>),
<br>Great grandson of the sovereign</span></li>
<li itemscope itemtype="http://schema.org/Person"><span itemprop="name">Princess Charlotte of Cambridge</span>
<br><span class="small">Age 2
(born <a title="Line of Succession on 02 May 2015" href="/2015-05-02">02 May 2015</a>),
<br>Great granddaughter of the sovereign</span></li>
...
</ol>
The CSS is all standard Bootstrap 4.0. Oh, except this bit:
span.small {
font-size: 75%;
}

You can use css counters. Also you have to add a class to the omitted element.
Stack Snippet
ul {
font: 13px Verdana;
list-style: none;
counter-reset: list;
padding: 0;
}
ul>li:not(.disable):before {
counter-increment: list;
content: counter(list) ": ";
position: absolute;
left: 0;
}
ul>li {
position: relative;
padding-left: 20px;
}
ul>li.disable {
opacity: .5;
}
<ul>
<li>Text</li>
<li>Text</li>
<li class="disable">Text</li>
<li>Text</li>
<li>Text</li>
<li>Text</li>
<li>Text</li>
<li>Text</li>
</ul>

You could use css counters
ol {
counter-reset: item;
list-style: none;
margin: 0;
padding: 0;
}
ol li {
display: block;
padding: 0 0 0 2.5em;
margin: 0;
position: relative;
}
ol .counted:before {
content: counters(item, ".") " ";
counter-increment: item;
position: absolute;
left: 0;
top: 0;
display: inline-block;
width: 2.5em;
}
ol .level1>li {
margin: 0;
padding-left: 0;
}
ol .level1>.counted:before {
left: -2.5em;
font-weight: normal;
}
ol .level2>.list-item {
padding-left: 2.5em;
}
ol .level2>.list-item:before {
left: -1em;
width: 3.5em;
}
.not-counted {color:green;}
<ol>
<li class="counted">
this is counted
<ol class="level1">
<li class="counted">
this is counted
</li>
<li class="not-counted">
this is not counted
</li>
<li class="counted">
this is counted
<ol class="level2">
<li class="counted">
this is counted
</li>
<li class="not-counted">
this is not counted
</li>
<li class="counted">
this is counted
</li>
</ol>
</li>
</ol>
</li>
<li class="not-counted">
this is not counted
</li>
<li class="counted">
this is counted
</li>
</ol>

Related

Ordered list 1, 1.1, a

Current result:
1. Item
1.1 Subitem
1.2 Subitem2
1.2.1 something more
1.2.2 another point
Desired result:
1. Item
1.1 Subitem
1.2 Subitem2
a. something more
b. another point
How do I modify my code to get the third level as letters instead of 3 numbers. I added the type="a" to the correct <ol> element in the HTML but it got overwritten.
ol {
list-style-type: none;
counter-reset: item;
margin: 0;
padding: 0;
}
ol>li {
display: table;
counter-increment: item;
margin-bottom: 0.6em;
}
ol>li:before {
content: counters(item, ".");
display: table-cell;
padding-right: 0.6em;
}
li ol>li {
margin: 0;
}
<ol>
<li>
<b>
Our rights if you breach this policy
</b>
<ol>
<li>
We will decide whether there has been a breach of this policy by you.
</li>
<li>
If we decide that you are in breach of any part of this policy, we may:
<ol type="a">
<li>
issue a warning to you;
</li>
<li>
immediately stop your right to use our Service;
</li>
<li>
take legal action against you to recover any of our losses caused by your breach; or
</li>
<li>
notify law enforcement authorities if we decide that you have broken any law; or
</li>
<li>
take any other action that we think is appropriate.
</li>
</ol>
</li>
</ol>
</li>
</ol>
You can use list-style-type: lower-alpha; and cancel out your counters with the :not() pseudo class:
At the end of your stylesheet create a rule that targets your type="a" and assigns the list style type you want (lower-alpha).
Your counters will override this declaration so an easy solution is to only apply them to <ol> elements that are :not([type="a"]) (Not one of your alpha lists).
Hopefully this works for you:
ol {
list-style-type: none;
counter-reset: item;
margin: 0;
padding: 0;
}
ol:not([type="a"]) > li {
display: table;
counter-increment: item;
margin-bottom: 0.6em;
}
ol:not([type="a"]) > li::before {
content: counters(item, ".");
display: table-cell;
padding-right: 0.6em;
}
ol[type="a"] {
list-style-type: lower-alpha;
}
<ol>
<li>
<b>
Our rights if you breach this policy
</b>
<ol>
<li>
We will decide whether there has been a breach of this policy by you.
</li>
<li>
If we decide that you are in breach of any part of this policy, we may:
<ol type="a">
<li>
issue a warning to you;
</li>
<li>
immediately stop your right to use our Service;
</li>
<li>
take legal action against you to recover any of our losses caused by your breach; or
</li>
<li>
notify law enforcement authorities if we decide that you have broken any law; or
</li>
<li>
take any other action that we think is appropriate.
</li>
</ol>
</li>
</ol>
</li>
</ol>

How can I make an ordered list go 1. 1.1, 1.2, A, B, C, 1.3, 1.4

Since I have not found a post on StackOverflow that satisfies my needs for what I am trying to do, I have made a new question covering my problem.
I am trying to build an ordered list, where I want to have:
1.
1.1
A
B
C
1.2
1.3
Currently, I have the following:
1.
1.1
1.1.1
1.1.2
1.1.3
1.2
1.3
I have tried a few things without luck though, so I would appreciate if I can get some help.
Is this possible what I am trying to do? If yes, how? If no, why?
ol {
list-style-type: none;
counter-reset: item;
margin: 0;
padding: 0;
}
li {
display: table;
counter-increment: item;
margin-bottom: 0.6em;
}
li:before {
content: counters(item, ".") ". ";
display: table-cell;
padding-right: 0.6em;
}
li li {
margin: 10px;
}
li li:before {
content: counters(item, ".") " ";
}
.bolder {
font-size: 1.17em;
font-weight: bolder;
margin: 0px;
}
.parent::before {
font-size: 1.17em;
font-weight: bolder;
}
<li class="parent">
<p class="bolder">How I want it to look like</p>
<ol>
<li>This is 1.1
<ol>
<li class="subItem">
This is what I want to be A
</li>
<li class="subItem">
This is what I want to be B
</li>
<li class="subItem">
This is what I want to be C
</li>
</ol>
</li>
<li>
Then it continues on with 1.2
</li>
<li>
Then 1.3.. etc.
</li>
</ol>
</li>
If you want to target the third level of lis you can use the ol ol ol li selector. To use uppercase letters, you can use a counter() instead of counters() as with counters() the generated text is the value of all counters while with counter() it's the value of the innermost counter only.
If you set the counter style to upper-alpha the markers will be uppercase letters.
ol {
list-style-type: none;
counter-reset: item;
margin: 0;
padding: 0;
}
li {
display: table;
counter-increment: item;
margin-bottom: 0.6em;
}
li:before {
content: counters(item, ".") ". ";
display: table-cell;
padding-right: 0.6em;
}
li li {
margin: 10px;
}
li li:before {
content: counters(item, ".") " ";
}
.bolder {
font-size: 1.17em;
font-weight: bolder;
margin: 0px;
}
.parent::before {
font-size: 1.17em;
font-weight: bolder;
}
ol ol ol li:before {
content: counter(item, upper-alpha);
}
<ol>
<li class="parent">
<p class="bolder">How I want it to look like</p>
<ol>
<li>This is 1.1
<ol>
<li class="subItem">
This is what I want to be A
</li>
<li class="subItem">
This is what I want to be B
</li>
<li class="subItem">
This is what I want to be C
</li>
</ol>
</li>
<li>
Then it continues on with 1.2
</li>
<li>
Then 1.3.. etc.
<ol>
<li class="subItem">
This is what I want to be A
</li>
<li class="subItem">
This is what I want to be B
</li>
</ol>
</li>
</ol>
</li>
</ol>
I think the best way to approach this would be to assign a class to the list that you want to display the letter style then use list-style-type:upper-alpha in that class.

CSS general element takes precedence over classes?

ul {
width: 250px;
}
li {
margin: 10px;
}
ul.illuminations {
list-style-position: outside;
}
ul.season {
list-style-position: inside;
}
ul.2 {
list-style: inside circle;
width: 300px;
}
li.3 {
margin: 100px;
}
<ul class="illuminations">
<li>That idol, black eyes and yellow mop, without parentsw our court ...</li>
<li>Gracious son of Pan! Around your forehead crowned with flowerets ...</li>
<li>When the world is reduced to a single dark wood for our four...</li>
</ul>
<hr />
<ul class="season">
<li>Once, if my memory serves me well, my life was a banquet...</li>
<li>Hadn't I once a youth that was lovely, heroic, and fabulous...</li>
<li>Autumn already! - But why regret the everlasting sun if we are</li>
</ul>
<hr />
<h1>Quotes from Edgar Allan Poe</h1>
<ul class="2">
<li class="3">I have great faith in fools; self-confidence my friends call it.</li>
<li class="3">All that we see or seem is but a dream within a dream.</li>
<li class="3">I would define, in brief, the poetry of words as the rhythmical creation of beauty.</li>
</ul>
The first two lists do acquire the different marker positions. However, the last list doesn't acquire the list style and width attributes that I intend it to by using the more specific declarations. This is a problem I've encountered many times now. Why is this and how am I supposed to target specific elements in order to override attributes?
CSS identifiers can't begin with a digit. So .2 and .3 are invalid selectors. You can escape them as .\32 and .\33.
ul {
width: 250px;
}
li {
margin: 10px;
}
ul.\32 {
list-style: inside circle;
width: 300px;
}
li.\33 {
margin: 100px;
}
<ul class="2">
<li class="3">I have great faith in fools; self-confidence my friends call it.</li>
<li class="3">All that we see or seem is but a dream within a dream.</li>
<li class="3">I would define, in brief, the poetry of words as the rhythmical creation of beauty.</li>
</ul>

HTML - ordered list, styling the list numbers like (a), (i), (aa)

I have attached my HTML and CSS file.
What I need: the "a." should be enclosed within () like (a) and the "i" in the next level as (i) and under the "i" the list number shown as "1" should be displayed as (aa) next as (ab) and so on.
I want the alignment to remain as it is and only the styling to change inline with my expectations. How to do this?
Note: The solution shouldn't cause change in alignment and JavaScript isn't allowed
p.p1 {
text-indent: 0cm;
margin-left: 36;
word-break: break-all;
}
li {
list-style-position: inside;
margin-top: 10pt;
word-break: break-all;
}
li::before {
content: "";
width: 13pt;
display: inline-block;
}
.ol1 {
padding-left: 2pt;
}
.pNote {
text-indent: 0cm;
margin: 0cm 0cm 10pt;
}
<ol class="ol1">
<li>FirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirst
<ol type="a">
<li>Bullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-a
<ol type="i">
<li>Bullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-i
</li>
<ol type="aa">
<li>Bullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aa
</li>
<li>
Bullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-ab
</li>
</ol>
<li>
Bullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-ii
</li>
</ol>
</li>
<li>
Bullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-b
</li>
</ol>
</li>
<li>
SecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecond
</li>
<li>
ThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThird
</li>
</ol>
As far as I know, the styling of list numbers with braces is currently not possible. There was a section in the CSS3 spec about custom defining counter styles and using it along with list-style-type but it doesn't seem to be implemented fully yet (atleast not cross-browser) and so your best bet would be to use counters for custom styling the list numbers instead of using the default list style types.
While using counters, we just have to assign one counter for each level, reset/initialize the counter at its corresponding ol tag, increment the counter's value whenever a li is encountered and display the value of the counter before the text using :before pseudo-element. Counter values are displayed using the content property of pseudo-elements and hence the braces can easily be added (it is just like doing string concatenation).
For the (aa), (bb) styles, there is defined counter-style-type and like varun aaruru had mentioned in his comment, there is no pre-defined counter/list style for this and such a value comes only after alphabet z is reached. In default ol styling this could be done giving a start value but it still does not produce the brackets and so we again have to use counters. In counters, we can achieve this by resetting the counter's initial value itself to 26 (z is the 26th alphabet).
The below snippet produces the output that you are looking for.
p.p1 {
text-indent: 0cm;
margin-left: 36;
word-break: break-all;
}
li {
list-style-position: inside;
margin-top: 10pt;
word-break: break-all;
}
li::before {
content: "";
width: 13pt;
display: inline-block;
}
.ol1 {
padding-left: 2pt;
}
.pNote {
text-indent: 0cm;
margin: 0cm 0cm 10pt;
}
/* initialize counters */
ol.a {
counter-reset: list-item-level2;
}
ol.i {
counter-reset: list-item-level3;
}
ol.aa {
counter-reset: list-item-level4 26;
}
/* nullify default list styling */
ol.a li,
ol.i li,
ol.aa li {
list-style-type: none;
}
/* reset the word break for pseudo elements */
ol.a li:before,
ol.i li:before,
ol.aa li:before {
word-break: normal;
}
/* increment the counters */
ol.a li {
counter-increment: list-item-level2;
}
ol.i li {
counter-increment: list-item-level3;
}
ol.aa li {
counter-increment: list-item-level4;
}
/* display the counter values */
ol.a li:before {
content: '('counter(list-item-level2, lower-latin)')';
margin-right: 16px;
}
ol.i li:before {
content: '('counter(list-item-level3, lower-roman)')';
margin-right: 16px;
}
ol.aa li:before {
content: '('counter(list-item-level4, lower-latin)')';
margin-right: 28px;
}
<ol class="ol1">
<li>FirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirstFirst
<ol class="a">
<li>Bullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-aBullet-a
<ol class='i'>
<li>Bullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-iBullet-i
</li>
<ol class="aa">
<li>Bullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aaBullet-aa
</li>
<li>Bullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-abBullet-ab
</li>
</ol>
<li>
Bullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-iiBullet-ii
</li>
</ol>
</li>
<li>
Bullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-bBullet-b
</li>
</ol>
</li>
<li>
SecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecondSecond
</li>
<li>
ThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThirdThird
</li>
</ol>

How to make nested lists with numbers and alphabetical

I'm trying to get a nested list to change from numbers to alphabetical. You can see JsFiddle where I have the class alpha I would like the 3.1.1 to change to a. Any ideas?
strong {
font-weight: 700;
}
.maincontent ol {
margin: 25px;
}
ol.tc li ol.d {
list-style-type: lower-alpha !important;
color: red;}
ol.tc {
counter-reset: item;
}
ol.tc li {
display: block;
position: relative;
}
ol.tc li:before {
content: counters(item, ".")".";
counter-increment: item;
position: absolute;
margin-right: 100%;
right: 10px; /* space between number and text */
}
ol.tc {
counter-reset: item;
}
ol.tc li:before {
content: counters(item, ".")".";
counter-increment: item;
position: absolute;
margin-right: 100%;
right: 10px; /* space between number and text */
}
ol.alpha {
counter-reset: item;
list-style-type: lower-alpha;
}
ol.alpha li:before {
list-style-type: lower-alpha;
position: absolute;
margin-right: 100%;
right: 10px; /* space between number and text */
color: pink;
}
<ol class="tc">
<ul>
<li><strong>Preconditions</strong><br>
<ol class="tc">
<li>Before we can provide you with Pay Monthly Services, you will need to:</li>
<li>Complete our application process and provide us with any information which we reasonably ask for.</li>
<li>Have a credit score and provide us with inancial security which is satisfactory to us. </li>
<li>Provide us with valid proof of identity and evidence that you are permanently living in the Republic of Ireland.
<li>Provide us with valid proof that you are aged over 18 years. </li>
</ol>
</li>
<li><strong>Tariff Limits</strong><br>
<ol class="tc">
<li>Tariffs may include a limit on the volume of Services, including minutes, texts and/or internet access, which can be used without extra charge. Charges for all Services in excess of any Tariff limits will be charged at the rates set out in the charges.</li>
</ol>
</li>
<li><strong>Call Charges covered by Tariff limits</strong><br>
<ol class="tc">
<li>Tariff limits cover calls made in Ireland to:
<ol>
<ol class="alpha">
<li>standard Irish landlines; and</li>
<li>08 numbers allocated to Irish mobile network operators.</li>
</ol>
</li>
</ul>
</ol>
html markup not valid
<ol class="tc">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</ol>
see answer below
strong {
font-weight: 700;
}
.maincontent ol {
margin: 25px;
}
ol.tc li ol.d {
list-style-type: lower-alpha !important;
color: red;}
ol.tc {
counter-reset: item;
}
ol.tc li {
display: block;
position: relative;
}
ol.tc li:before {
content: counters(item, ".")".";
counter-increment: item;
position: absolute;
margin-right: 100%;
right: 10px; /* space between number and text */
}
ol.tc {
counter-reset: item;
}
ol.tc li:before {
content: counters(item, ".")".";
counter-increment: item;
position: absolute;
margin-right: 100%;
right: 10px; /* space between number and text */
}
ol.alpha {
counter-reset: item;
}
ol.alpha li:before {
content: counter(item, lower-alpha) ". ";
counter-increment: item;
position: absolute;
margin-right: 100%;
right: 10px;
color: pink;
}
<ol class="tc">
<li><strong>Preconditions</strong>
<br/>
<ol class="tc">
<li>Before we can provide you with Pay Monthly Services, you will need to:</li>
<li>Complete our application process and provide us with any information which we reasonably ask for.</li>
<li>Have a credit score and provide us with inancial security which is satisfactory to us.</li>
<li>Provide us with valid proof of identity and evidence that you are permanently living in the Republic of Ireland.</li>
<li>Provide us with valid proof that you are aged over 18 years.</li>
</ol>
</li>
<li><strong>Tariff Limits</strong>
<br/>
<ol class="tc">
<li>Tariffs may include a limit on the volume of Services, including minutes, texts and/or internet access, which can be used without extra charge. Charges for all Services in excess of any Tariff limits will be charged at the rates set out in the charges.</li>
</ol>
</li>
<li><strong>Call Charges covered by Tariff limits</strong>
<br/>
<ol class="tc">
<li>Tariff limits cover calls made in Ireland to:
<ol class="alpha">
<li>standard Irish landlines; and</li>
<li>08 numbers allocated to Irish mobile network operators.</li>
</ol>
</li>
</ol>
The following would be an example for what you are trying to achieve:
<ol type="1">
<li> Decide on a subject.
<ol type="a">
<li> Business
<li> Family
<li> Hobby
</ol>
<li> Acquire the necessary tools and materials.
<ol type="a">
<li> Web browser
<li> Text editor or HTML editor
<li> Graphics and clip-art
<li> Graphics editor
</ol>
<li> Write the HTML source code.
</ol>
Just try it inside JFiddle without CSS code and change it to your wish.
The HTML you have is not valid, the only permitted content for <ol> and <ul> is zero or <li> elements.
For the alphabetical style, you will need the correct pseudo content for it.
.alpha li:before {
content: counter(item, lower-alpha)".";
}
See the update demo please - http://jsfiddle.net/sjqvpuuL/
ol {
counter-reset: item;
}
li {
display: block;
position: relative;
}
li:before {
content: counters(item, ".")".";
counter-increment: item;
position: absolute;
margin-right: 100%;
right: 10px;
}
.alpha li:before {
content: counter(item, lower-alpha)".";
}
<ol>
<li>
<strong>Preconditions</strong>
<ol>
<li>Before we can provide you with Pay Monthly Services, you will need to:</li>
<li>Complete our application process and provide us with any information which we reasonably ask for.</li>
<li>Have a credit score and provide us with inancial security which is satisfactory to us.</li>
<li>Provide us with valid proof of identity and evidence that you are permanently living in the Republic of Ireland.</li>
<li>Provide us with valid proof that you are aged over 18 years.</li>
</ol>
</li>
<li>
<strong>Tariff Limits</strong>
<ol>
<li>Tariffs may include a limit on the volume of Services, including minutes, texts and/or internet access, which can be used without extra charge. Charges for all Services in excess of any Tariff limits will be charged at the rates set out in the charges.</li>
</ol>
</li>
<li>
<strong>Call Charges covered by Tariff limits</strong>
<ol>
<li>Tariff limits cover calls made in Ireland to:
<ol class="alpha">
<li>standard Irish landlines; and</li>
<li>08 numbers allocated to Irish mobile network operators.</li>
</ol>
</li>
</ol>
</li>
</ol>