Custom bullet symbol for <li>
elements in <ul>
that is a regular character, and not an image
To create custom bullets for your <li>
elements, you will need to use certain CSS properties like ::before
and content
. Start by setting list-style-type
to none
on <ul>
to remove the default bullets. Next, define your desired character in content
, with proper padding and margins to ensure alignment.
Feel free to swap '•' for a character of choice - perhaps an emoji or special symbol. Adjust padding-right
and margin-left
for spacing.
Mastering bullets: advanced customizations
Context-specific bullets with emojis or predefined symbols
Depending on your content or design requirements, you might want to use emojis or predefined symbols to create a unique visual experience.
Precision alignment with positioning
If you want your bullets to march in a specific line, try using position: relative;
on the <ul>
and position: absolute;
on the ::before
pseudo-element:
Creating hanging indents with negative text-indent
Misaligned text got you down? Shake things up! Implement a negative text-indent for text to create a neat hanging indent effect:
Aligning text with absolutely positioned bullets
When you're using absolutely positioned bullets, you need to properly align text to keep aesthetics in order. This can be achieved with padding-left
:
Taming web fonts to create icon bullets
Web fonts like Font Awesome not only offer a vast array of options, but they're also scalable and accessible, which is pretty awesome.
Was this article helpful?