Common font units in CSS: differences between px, em, rem, and %, pxrem
When I first came into contact with CSS, px was widely used and well understood. However, after a long time, I found some defects, especially in responsive development.
So when should so many units be used? Let's discuss it today.
First, let's roughly explain the meaning of these units:
1. px
selection to consider the use of the text, is to do the title, or paragraph text?
Typically, San serif fonts are suitable for use as headings, such as Arial;serif fonts that are suitable for use as paragraph text, such as time New Roman. For web design, there are a few fonts I strongly recommend, Verdana, Tahoma, Georgia. In fact, like Verdana This font is designed by the world's top font designers for al
consider the use of the text, is to do the title, or paragraph text?
Typically, San serif fonts are suitable for use as headings, such as Arial;serif fonts that are suitable for use as paragraph text, such as time New Roman. For web design, there are a few fonts I strongly recommend, Verdana, Tahoma, Georgia. In fact, like Verdana This font is designed by the world's top font designers for almost two year
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 a wide controversy. It is difficult to find a definite answer, because it is so difficul
A few days ago, when I made the online dictionary service on this site, I had a problem with the English alphabet fonts. In Baidu's English dictionary, the phonetic alphabet is made into an image. When the result is output, the corresponding phonetic alphabet image is output, but I don't want to use this method. I want users to directly see the phonetic alphabet without downloading and installing fonts. I thought of the font import function in
, such as Time New Roman. I strongly recommend several fonts for web design, such as verdana, tahoma, and georgia. In fact, the font like Verdana was designed by the world's top font designers for almost two years. Microsoft pays for it and then provides it to users for free, this font is part of IE installation. If you have installed IE 4 or later, you must have
suitable for use as headings, such as Arial;serif fonts for use as paragraph text, such as time New Roman. For web design, there are a few fonts that I highly recommend, Verdana, Tahoma, Georgia. In fact, like Verdana This font is designed by the world's top font designers for almost two years, Microsoft is responsible for the bill, and then free to users, this font
density. You can also specify a specific DPI value directly, which allows a range of 70-400. DEVICE-DPI indicates that the page is displayed at the device's default DPI.Note: All scaling values must be within the range of 0.01-10, otherwise invalid.Comparison of several different units in CSSpx: pixels (Pixel). Relative length units, the size is determined by the screen resolution.em: relative length units. The font size equivalent to the text within
CSS in the use of font-size set font size, different browser font height, but different width, such as in Firefox and Google, font-size:20px, font height to 20px, but Google's font widt
In the new contact with CSS, px with more, but also very good understanding, but with a long time will find some defects, especially in the response to develop the time.So when is it that so many units are suitable? Let's talk about it today.First of all, explain the meaning of these units:1, pxPX unit names are pixels and pixels are fixed-sized units for screen media (that is, read on a computer screen). A pixel is equal to a point on the computer sc
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 size is 24px, but the final calculation is 53px, see this bizarre result, my heart cursed a sentence
: Cursive font - Pstyle= "font-size:20px;font-family:cursive;">the sunrise, and the day into the interest. To dig well and drink, to plough and eat. Dili to me! IHKP> [email protected] Time: 2017-04-12 Description: Unreal font - Pstyle= "Font-size:20
css| Control ★☆★ Use CSS you can control the font of the page arbitrarily, compared to the HTML is simply easy to know how much.
CSS uses the "Font-size" property to control the font size.
CS
Tag: Image its screen resolution differs body decision. com doc size today, let's talk about the three font units most commonly used in CSS: Px,em and REM. PX is a unit of relative length, its size is relative to the screen resolution, EM and REM are different, in short, their font size is determined by the reference. For EM, its reference, is the parent
Tag: font font-sizeline-height CSS fonts css fontFont of CSS Properties (fonts)font:[[Composite properties, see below for each attribute.Both Font-size and
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 size is 24px, but the final calculation is 53px, see this bizarre result, my heart cursed a sentence
Font use is an integral part of web design. A Web page is a vector of text, and we want to use a particular font in a Web page, but the font is not a built-in font for the main operating system, so users may not see the real design when they browse the page.The most common way for artists to do this is to make a pictur
. 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 know the size of his parent element, in multiple uses, will bring unpredictable error risk
When designing a network application, you must decide how to edit the font. There are a number of options when using CSS , and each developer has its own preferences. This article mainly discusses the font size and the operation within the network application. There is nothing more important in developing a Web application than it looks. So, I wouldn't be surpris
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.