1. Introduction In the past, if you wanted to emphasize a certain part of the text, you usually did it by making it bold or using a bright color. Now there is a new option, which is to use There are 4 CSS properties in
Among them, 2. Details 1. text-emphasis-color 2. text-emphasis-style There are three main types of text-emphasis-style: none text-emphasis-style: [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] text-emphasis-style: <string> in: Baby, <span class="emphasis">love you</span>, <span class="emphasis">heart</span>! .emphasis { -webkit-text-emphasis-style: '❤'; text-emphasis-style: '❤'; } The effect is shown in the figure below. You can see that a heart character appears above the corresponding text (because the Emoji font is applied, the Emoji character is displayed). Here are a few details to share with you: The font size of the emphasis decorator displayed is half the font size of the main text content. For example, if the text is If multiple characters are specified, only the first character will be used as the emphasis modifier. For example: text-emphasis-style: 'CSS New World'; is equivalent to: text-emphasis-style: 'C'; Finally, let’s take a look at the built-in decorative character effects of Each decorator has two types of characters: filled and hollow, which are determined by the two keywords For example: /* Solid dot */ text-emphasis: filled dot; /*Hollow dot*/ text-emphasis: open dot; Since built-in characters are solid by default, If /* Equivalent to text-emphasis: filled dot */ text-emphasis: filled; /* Equivalent to text-emphasis: open dot */ text-emphasis: open; As for the specific effects of each decorative symbol, I (Zhang Xinxu) specially made a table for your convenience. See the table below for details. The font size of each emphasis decorator is greatly affected by the font. You can choose to use the appropriate emphasis decorator according to the actual scenario. 3. Text-emphasis-position The syntax is as follows: text-emphasis-position: [ over | under ] && [ right | left ] Usage instructions: text-emphasis-position: over left; text-emphasis-position: under right; text-emphasis-position: under left; text-emphasis-position: left over; text-emphasis-position: right under; text-emphasis-position: left under; The initial value of Therefore, to emphasize Chinese content, in addition to setting the emphasis decorator, you also need to set the position of the emphasis decorator to the bottom, for example: .chinese-emphasis { -webkit-text-emphasis: dot; text-emphasis: dot; -webkit-text-emphasis-position: under right; text-emphasis-position: under right; } Here is a small detail. In Chrome browser, -webkit-text-emphasis-position: under; However, please note that this approach of the Chrome browser is actually wrong and does not conform to the specification description. The specification requires that -webkit-text-emphasis-position: under right; 4. Text-emphasis text-emphasis: circle deepskyblue; In terms of syntax and semantics, The only thing worth mentioning is that Another small difference is that 3. Summary I reviewed the projects I have experienced and found places where In short, the CSS Finally, let’s show the browser compatibility of Summarize This is the end of this article about using CSS text-emphasis to emphasize text. For more relevant CSS text-emphasis text decoration content, please search 123WORDPRESS.COM’s previous articles or continue to browse the related articles below. I hope that everyone will support 123WORDPRESS.COM in the future! |
<<: How to create a style guide for your website in web interface design (with pictures and text)
>>: Detailed example of HTML element blocking Flash
<button> tag <br />Definition and usag...
Because I have a database tutorial based on SQL S...
The form elements with visibility=hidden and displ...
1. Cancel the blue color of the a tag when it is ...
List of HTML tags mark type Name or meaning effec...
I learned a new trick today. I didn’t know it befo...
1. Introduction (1) Introduction to vw/vh Before ...
Preface When a Linux is fully set up, you can use...
The smallest scheduling unit in k8s --- pod In th...
When checking the slow query, I found that the ti...
Table of contents Preface What is metadata Refere...
Table of contents 1. Easy to read code 1. Unified...
1. List The list ul container is loaded with a fo...
Table of contents DOMContentLoaded and load What ...
This article shares the installation and activati...