Home > Article > Web Front-end > What should I do if Google Chrome does not support CSS settings for text smaller than 12px?
The tutorial I bring to you today is a solution to the problem that Google Chrome does not support setting CSS smaller fonts.
Web pages often use large or small text for beautiful layout. Usually ##font-size text is 12px (pixel) text. Set the text font to be larger than 12px, and each browser can display the text size effect set by CSS. However, when the CSS setting is smaller than 12px text, Google Chrome cannot display the text font effect set by CSS smaller than 12px.
Google Chrome support settingsfont-sizeSolution for pixels smaller than 12px
The default minimum font of Google Chrome is 12px, and fonts smaller than 12px will be displayed as 12px. Sometimes we need to make the font smaller, especially when making English websites, we often use CSS styles to display text smaller than 12px, so that Google Chrome cannot display the smaller text. There are solutions though. Solve the required CSS code Add a Google Chrome-specific kernelattribute style in the html or body (or if you need to set the small text font object CSS SelectorYou can also add) the following CSS code:
html,body{-webkit-text-size-adjust:none;}或.pcss5{-webkit-text-size-adjust:none;}Note: If this attribute is used, the browser's font will not be able to use the zoom function! (It is the function of holding down the CTRL key and scrolling the middle mouse button up and down) Try changing the unit - useless: Some friends also said that using em (characters) as the unit to define the font size is useful. I have personally tested that the smallest font size in Google Chrome will not be smaller than 12px. So it's useless. For now I only know the above method. I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website! Related reading:
Answers to questions about camel case naming and JS
Boolean values, relational operators in JS, Detailed explanation and examples of logical operators
The above is the detailed content of What should I do if Google Chrome does not support CSS settings for text smaller than 12px?. For more information, please follow other related articles on the PHP Chinese website!