Layout.css.dpi: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(→‎Background: added examples to make it more intuitive)
Line 4: Line 4:
[[CSS]] can use a variety of [http://www.w3.org/TR/CSS21/syndata.html#length-units units] for specifying dimensions. These units are classified as either absolute or relative. Absolute units (inches, centimeters, millimeters, points, and picas) are intended for use when the final output medium is of known dimensions; for example, in a print stylesheet. When they are used onscreen, their actual values must be calculated based on the [http://en.wikipedia.org/wiki/Dots_per_inch DPI] of the screen.
[[CSS]] can use a variety of [http://www.w3.org/TR/CSS21/syndata.html#length-units units] for specifying dimensions. These units are classified as either absolute or relative. Absolute units (inches, centimeters, millimeters, points, and picas) are intended for use when the final output medium is of known dimensions; for example, in a print stylesheet. When they are used onscreen, their actual values must be calculated based on the [http://en.wikipedia.org/wiki/Dots_per_inch DPI] of the screen.


This preference determines what DPI should be used for calculating the dimensions of elements set using absolute width units.
This preference determines what DPI should be used for calculating the dimensions of elements set using absolute width units. Some examples: At 96dpi, a 12-point font will be displayed with 16 pixels in size (calculated as 12/72 = 16/96); conversely, an 18px font will be printed as 13.5pt (18/96 = 13.5/72).


Previously known as [[browser.screen_resolution]] (in Firefox 1.0.x) and [[browser.display.screen_resolution]] (in Firefox 1.5.0.x).
Previously known as [[browser.screen_resolution]] (in Firefox 1.0.x) and [[browser.display.screen_resolution]] (in Firefox 1.5.0.x).

Revision as of 02:39, 20 August 2007

Background

CSS can use a variety of units for specifying dimensions. These units are classified as either absolute or relative. Absolute units (inches, centimeters, millimeters, points, and picas) are intended for use when the final output medium is of known dimensions; for example, in a print stylesheet. When they are used onscreen, their actual values must be calculated based on the DPI of the screen.

This preference determines what DPI should be used for calculating the dimensions of elements set using absolute width units. Some examples: At 96dpi, a 12-point font will be displayed with 16 pixels in size (calculated as 12/72 = 16/96); conversely, an 18px font will be printed as 13.5pt (18/96 = 13.5/72).

Previously known as browser.screen_resolution (in Firefox 1.0.x) and browser.display.screen_resolution (in Firefox 1.5.0.x).

Possible values and their effects

-1

Use the host system’s logical resolution or 96, whichever is greater, for interpreting dimensions specified in absolute units. (Default)

0

Use the host system’s logical resolution for interpreting dimensions specified in absolute units.

(any positive integer)

Use this number for interpreting dimensions specified in absolute units.

Caveats

  • This preference is not meant as a general “zoom” feature to scale all rendered web content.
  • This preference has no effect in Windows (the OS’s DPI setting is queried directly).

First checked in

2006-02-28 by L. David Baron

Has an effect in

  • Firefox (all versions since 2.0)
  • SeaMonkey (Trunk and branch builds after 2006-02-28)

Related bugs

Related preferences

External links