way, regardless of how the screen width changes, the H1 font size remains at 2.5% of the viewport width.
Considering the development of a future responsive design, if you want, the height of the browser can also be adjusted based on the percentage value. However, using a percentage-based value is not always the best way to define the size of the browser window
text.Use EM to set font sizeMany developers use EM units instead of pixels to avoid problems with text that cannot be adjusted in Internet Explorer. It is recommended to use EM size units. 1em equals the current font size. If the font-s
First, CSS how to set the font type, size, colorWhen designing a Web page, it is generally necessary to set the body font to allow other tags to inherit the body font, which is especially handy, but the title tag H1 to H6 and the form label (input type) are not inherited bod
Common units
You can set the size of a font in many different ways in CSS. In general, these units are divided into two broad categories: absolute units (absolute) and relative units (relative).
Absolute units are in most cases fixed values relative to some actual metrics, meaning that once they are set, they are not changed by the
on what I think is most commonly used in units--px, PT,%, EM, REM, and VW.
What's the difference between them?
The differences between these units may be difficult to understand by concept, so the best way is to show their differences through examples.
Example 1--default settings
In a blank HTML document, you do not have any statement about the size of the font
Common unitsThere are many different ways to set the size of a font in CSS. In general, these units are divided into two main categories: absolute units (absolute) and relative units (relative).
absolute units are, in most cases, fixed values relative to certain actual measures, that is, once they are set, they are not changed by the
When I recently made a mobile-phone page, I encountered a strange problem: The font display size is inconsistent with the size specified in the CSS. You can view this demo (remember to open chrome DevTools).As shown, you can find that the originally specified font
Order:
Font-size Line-height font-family
{ font-size: 12px} { font:}
Where Line-height is a Text property , but it can also be used as a complement to the Font-
When I recently made a mobile-phone page, I encountered a strange problem: The font display size is inconsistent with the size specified in the CSS. You can view this demo (remember to open chrome DevTools).As shown, you can find that the originally specified font
The length unit mainly has the following kinds of EM ex ch REM VW VH vm cm mm in pt pc px%, presumably can be divided into several "absolute units" and "relative units" and "percent units".
Absolute unit: px in cm mm
Relative unit: EM rem pt PC EX CH
Percent unit: VW VH VM%
The following mainly say a few commonly used units
PX: Absolute Unit, page by ex
CSS Font Properties Define text (such as italic) and deform (such as small capital letters)Code collated from w3school:http://www.w3school.com.cn:CSS: Font styles (font family, size, bold, style, warp, etc.)
In the overall layout of the page, the size of the page elements (length, width, padding, and so on) and page font sizes is also one of the important tasks. A reasonable setting, it will make the page look hierarchical, focus on bright, pleasing. Conversely, an unfriendly page size and font
All CSS Font properties:Font sets all of the fonts properties in a declarationfont-family font family for specified textFont-size the font size of the specified textFont-style the font
One, CSS length value
em
relative to the parent element's font size
ex
height relative to lowercase "x"
gd
Generally used in East Asian typography, this is not related to English
rem
relative to the root element font
This article mainly introduces the use of CSS font-size-adjust properties to improve the page layout, with a certain reference value, interested in small partners can refer to
The Font-size-adjust property in CSS allows developer
px Pixels (Pixel). Relative length units. Pixel px is relative to the display screen resolution .EM is the relative length unit. font-size the size of the parent setting , relative to the font size of the text within the current object. If the
. Similar to the concept of ex, the height of the ex relative to the character "X" is typically half the size of the font.
rem: REM is a new CSS, EM is relative to its parent element to set the font size, so there will be a problem, any element settings, you may need to
One of the most confusing aspects of CSS styling is the Font-size property of the text extension in your application. In CSS, you can display the size of text in a Web browser in four different units of measure. Which of the four units is best for the Web? The problem arouse
One of the most confusing aspects of CSS styling is the Font-size property of the text extension in your application. In CSS, you can display the size of text in a Web browser in four different units of measure.Which of the four units is best for the Web? The problem aroused
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.