I am looking for a way to create the following effect with CSS.
I found some solutions for putting dots below the text (white dots below HTML text), but I don't want "dotted underlining", I want every character to have just a single dot below it. Also the dot should increase with the font-size of the text (although if needed, I could mess with JS to fix that).
How could I achieve that?
The simplest way to add an icon to your HTML page, is with an icon library, such as Font Awesome. Add the name of the specified icon class to any inline HTML element (like <i> or <span> ). All the icons in the icon libraries below, are scalable vectors that can be customized with CSS (size, color, shadow, etc.)
Unicode includes ⠇ which is the Braille symbol for the letter "U". To use, just use the HTML entity ⠇ in your code.
All you need to do is to apply . halfStyle class to each element that contains the character you want to be half-styled. For each span element containing the character, you can create a data attribute, for example here data-content="X" , and on the pseudo element use content: attr(data-content); so the .
CSS Text Decoration Module Level 3 defines those properties:
text-emphasis-style
This property applies emphasis marks to the element's text. [...]
The marks are drawn once for each character.
text-emphasis-position
This property describes where emphasis marks are drawn at.
When browsers support that, you will be able to use
text-emphasis-style: dot;
text-emphasis-position: under left; /* or `under right` */
body {
text-emphasis-style: dot;
text-emphasis-position: under left;
-webkit-text-emphasis-style: dot;
-webkit-text-emphasis-position: under;
font-size: 300%;
}
ieuw
However, it is not widely supported yet. See caniuse for full details.
Firefox supports it since version 46, or since version 45 if you enable layout.css.text-emphasis.enabled
flag.
Chrome supports it since version 25, but needs the -webkit-
vendor extension.
Note the standard text-emphasis-position
uses a 2-value syntax (for horizontal and vertical writing modes, respectively), but there is a suggestion to allow 1-value syntax too. However, -webkit-text-emphasis-position
doesn't allow the 2-value syntax, only the 1-value one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With