Reputation: 962
In my sandbox here:
.thunderbolt li:nth-child(1):before {content: "\26A1 ";}
.thunderbolt li:nth-child(2):before {content: "🔁 ";}
.thunderbolt li:nth-child(3):before {content: "🏃 ";}
.thunderbolt li:nth-child(4):before {content: "🕔 ";}
.thunderbolt li:nth-child(5):before {content: "🚫 ";}
.thunderbolt li:nth-child(6):before {content: "\2685";}
<div>
<ul class="thunderbolt">
<li>ThunderBolt devices only get recognized by BootCamp on boot.</li>
<li>If you unplug your ThunderBolt device while using Windows, you'll have to shut down then reboot your OS to get it recognized again.</li>
<li>Disable <b>Fast Startup </b>in Windows 8/10.</li>
<ul>
<li>Also try holding <b>Shift </b>when you click <b>Start </b>> <b>Shut down</b>.</li>
</ul>
<li>Wait a solid chunk of seconds on the login screen after boot to allow BootCamp to configure Thunderbolt devices.</li>
<li><b>Sleep </b>simply does not work in BootCamp with a ThunderBolt device connected.</li>
</ul>
</div>
I want the unicode characters to replace the bullet points. Instead, the characters are just showing up alongside the bullet points, in-line with the text.
Also, I don't want the .thunderbolt
class to apply to the nested <ul>
--I just want that to be a standard bullet point.
I've tried .thunderbolt list-style: none
but all that did was make my thunderbolt symbol disappear.
Also, the resulting webpage displayed skips the character in .thunderbolt li:nth-child(4):before {content: "🕔 ";}
for the 4th child and displays the character from .thunderbolt li:nth-child(5):before {content: "🚫 ";}
instead. It seems the code treats the one nested <li>
as if it were the 4th child in the parent <ul>
.
<ul>
with a unicode character?<ul>
's when applying nth-child(n)
properties?Upvotes: 1
Views: 6517
Reputation: 962
ul.thunderbolt > li:nth-child(1) {
list-style: "\26A1 ";
list-style-position: outside;
}
ul.thunderbolt > li:nth-child(2) {
margin-top: 10px;
list-style: "🔁 ";
list-style-position: outside;
}
ul.thunderbolt > li:nth-child(3) {
margin-top: 10px;
list-style: "🚫 ";
list-style-position: outside;
}
ul.thunderbolt > li:nth-child(5) {
margin-top: 10px;
list-style: "🕔 ";
list-style-position: outside;
}
ul.thunderbolt > li:nth-child(6) {
margin-top: 10px;
list-style: "😴 ";
list-style-position: outside;
}
ul.thunderbolt ul li {
margin-top: 10px;
list-style-type: circle;
}
<ul class="thunderbolt">
<li>ThunderBolt devices only get recognized by BootCamp on boot.</li>
<li>If you unplug your ThunderBolt device while using Windows, you'll have to shut down then reboot your OS to get it recognized again.</li>
<li>Disable <b>Fast Startup </b>in Windows 8/10.</li>
<ul>
<li>Also try holding <b>Shift </b>when you click <b>Start </b>> <b>Shut down</b>.</li>
</ul>
<li>Wait a solid chunk of seconds on the login screen after boot to allow BootCamp to configure Thunderbolt devices.</li>
<li><b>Sleep </b>simply does not work in BootCamp with a ThunderBolt device connected.</li>
</ul>
> li
makes the style changes only affect elements in the parent list.ul.class_name ul li
to change the list-style-type
of the one nested <li>
item to an open circle
instead of a closed disc
.!important
after my changes in order for them to apply.
list-stye: "\26A1 "!important;
list-style-position: outside!important;
<li>
as nth-child(4)
, so I had to skip it in my nth-child(n)
numbering in my parent list. (Notice I do nth-child(3)
then skip to nth-child(5)
.)Upvotes: 3
Reputation: 27
Answer 1: If you use unicode instead of bullets, you will need to use,
.thunderbolt li: {
position: relative;
list-style: none;
overflow: hidden;
}
.thunderbolt li:after {
position: absolute;
top: 50%;
left: -2%;
transform: transletX(-50%);
}
And please use your unicode as a position: absolute;
, I hope your code is easy solution. Same css will work all li
but individually you just change content: 'here is your unicode';
I hope it will be easiest way to implement unicode items instead of bullet item.
Answer 2: If you use .thundebolt > li
then i hope it will work only on specific list. You can try it.
Note: If you have better solution let me, i want to know more from you, thank you!
Upvotes: 0