In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to set font properties in CSS". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to set font properties in CSS.
CSS font
The CSS font (font) property defines the font in the text.
Setting CSS font properties is one of the most common uses of stylesheets. The CSS font properties allow you to set font family (font-family) and font bold (font-weight), as well as font size, font style (such as italics), and font distortion (such as small uppercase letters).
Specify CSS font
You can use the font-family property to use a certain font family in the document.
Use a generic CSS font family
If you want your document to use a sans-serif font, but you don't care which font it is, here is an appropriate statement:
Body {font-family:sans-serif;} so that the user agent selects a font (such as Helvetica) from the sans-serif font family and applies it to the body element. Because of inheritance, this font selection will also be applied to all elements contained in the body element, unless a more specific selector overrides it.
Specify CSS font family
In addition to specifying a generic font family, you can also set more specific fonts through the font-family property.
The following example sets the Verdana font for all H2 elements:
H2 {font-family:Georgia;}
Such a rule also creates another problem: if the Georgia font is not installed on the user agent, you can only use the default font of the user agent to display H2 elements.
We can solve this problem by combining specific font names and generic font families:
H2 {font-family:Georgia,serif;}
If the reader does not have Georgia installed, but does install Times fonts (a font in the serif font family), the user agent may use Times for H2 elements. Although Times and Georgia do not exactly match, they are at least close enough.
Therefore, we recommend that a common CSS font family be provided in all font-family rules. This provides a back way to select a candidate font when the user agent is unable to provide a specific font that matches the rule.
If you are familiar with fonts, you can also specify a series of similar fonts for a given element. To do this, you need to prioritize these fonts and then concatenate them with commas:
P {font-family:Times,TimesNR,'NewCenturySchoolbook', Georgia,'NewYork',serif;}
According to this list, the user agent looks for these fonts in the order listed. If all the fonts listed are not available, one of the available serif fonts is simply selected.
Use quotation marks
You may have noticed that single quotation marks are used in the above example. Only if a CSS font name has one or more spaces (such as NewYork), or if the font name includes symbols such as # or $, you need to put quotation marks in the font-family declaration.
Either single or double quotation marks are acceptable. However, if you put a font-family attribute in the style attribute of HTML, you need to use quotation marks of the kind that the attribute itself does not use.
At this point, I believe you have a deeper understanding of "how to set font properties in CSS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.