


#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!

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

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.

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 viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

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

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit


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

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
