Skip to main content

DENSITY_ATTRIBUTE

Constant DENSITY_ATTRIBUTE 

Source
pub const DENSITY_ATTRIBUTE: &str = "data-density";
Expand description

The root-element attribute a user’s density choice is written to.

Detection is a default rather than a verdict: a touchscreen laptop wants to be told it is a pointer machine, and someone with a mouse may still want roomier targets. density_css emits a block for each value of this attribute on :root, after the capability query, so setting data-density="pointer" or data-density="touch" on <html> wins over what the device reports in either direction, and removing it hands the choice back to detection.

The choice belongs to the device rather than the account, for the reason detection does: it is a claim about what is pointing at this screen.