


How to express length in html? Several common length representation methods in html
#How to express length in html? What are some common length representation methods in HTML? This article brings you content about the HTML medium length method. I hope it will be of some help to you.
The following is a summary of pCSS5’s introduction to common html units in web pages and an introduction to length units in css p layout.
In fact, there are 8 length units in CSS, namely px, em, pt, ex, pc, in, mm, cm;
px: pixel (Pixel), relative to the length unit of the device, pixels are relative to the display screen resolution. For example, the resolution used by WONDOWS users is generally 96 pixels/inch. The resolution used by MAC users is generally 72 pixels/inch.
em: Relative length unit. The font size relative to the text within the current object. If the font size of the current inline text has not been manually set, it is relative to the browser's default font size.
ex: Relative length unit. Height relative to character "x". This height is usually half the font size. If the current font size for inline text has not been manually set, it will be relative to the browser's default font size.
pt: Point, absolute unit of length.
pc: Pica, absolute unit of length. It is equivalent to the size of my country's new No. 4 type.
in: Inch, absolute unit of length.
mm: Millimeter, absolute unit of length.
cm: Centimeter, absolute unit of length.
Among them: 1in = 2.54cm = 25.4 mm = 72pt = 6pc;
We often use px as the unit for the size of the container, and everyone has no objection. The font size (font-size) is many domestically Many people use px as the unit. In fact, the only fatal disadvantage of using px as the font unit is that the browser font scaling function cannot be used under IE. Or hold down Ctrl and scroll the middle wheel of the mouse.
So many people suggest using html em units. For people who are used to using px, it is definitely not very convenient to use em. Here are some conversion formulas and comparison tables for your reference:
px to em :Example: 12px / 16px = .75em
px to %:Example: 12px / 16px * 100 = 75%
px to pt:Example: 16px * 72 (72 points = 1 inch) / 96 (96 pixels per inch in Windows, 72 in Mac) = 12pt
em to px:Example: .75em * 16px = 12px
em to %:Example: .75em * 100 = 75%
% to px:Example : 75 * 16px / 100 = 12px
% to em:Example: 75 / 100 = .75em
pt to px:Example: 12pt * 96ppi / 72ppi = 16px
Pixels | EMs | Percent | Points |
---|---|---|---|
6px | 0.375em | 37.5% | 5pt |
7px | 0.438em | 43.8% | 5pt |
8px | 0.5em | 50% | 6pt |
0.563em | 56.3% | 7pt | |
0.625em | 62.5% | 8pt | |
0.688em | 68.8% | 8pt | |
0.75em | 75% | 9pt | |
0.813em | 81.3% | 10pt | |
0.875em | 87.5% | 11pt | |
0.938em | 93.8% | 11pt | |
1em | 100% | 12pt | ##17px |
106.3% | 13pt | 18px | |
112.5% | 14pt | 19px | |
118.8% | 14pt | 20px | |
125% | 15pt | 21px | |
131.3% | 16pt | 22px | |
137.5% | 17pt | ##23px | |
143.8% | 17pt | 24px | |
150% | 18pt | Finally pCSS5 |
to lay out the web page in units: Personally think that the disadvantage of using px as the font unit and not being able to use the browser font scaling function under IE is no longer so important. Because the new versions of IE7 and IE8 already support the zoom function of the entire web page, including Firefox, which zooms the entire web page by default instead of scaling CSS fonts. Is there any significance in not simply scaling the font size? For more related tutorials, please visit:
http://www.php.cn/course/list/11.html
The above is the detailed content of How to express length in html? Several common length representation methods in html. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.
