W3C home > Mailing lists > Public > www-style@w3.org > February 2014

[css3-lists] padding-left on <ol> and <ul> elements

From: Jonathan Kew <jfkthame@googlemail.com>
Date: Sat, 22 Feb 2014 10:31:55 +0000
Message-ID: <53087C9B.3080802@gmail.com>
To: www-style list <www-style@w3.org>
In http://www.w3.org/TR/css3-lists/#html4, we have

   /* Box Model Rules */
   ol, ul {
	display: block;
	margin: 1em 0;
	padding-left: 40px;
   }

which results in a fixed padding-left, whereas other dimensions (e.g. 
the margin here, as well as that on li::marker later) are expressed 
using 'em', so that they scale with font size.

As a result, an example like:

data:text/html,
   <div style="font-size:16px"><ol><li>one<li>two<li>three</div>
   <div style="font-size:32px"><ol><li>one<li>two<li>three</div>
   <div style="font-size:48px"><ol><li>one<li>two<li>three</div>

looks pretty silly (in both Chrome and Firefox, for instance): the text 
of the list items stays lined up, but the markers begin to get pushed 
out of view to the left of the window.

If the padding-left were defined as 2.5em instead of 40px:

data:text/html,<style>ol{padding-left:2.5em}</style>
   <div style="font-size:16px"><ol><li>one<li>two<li>three</div>
   <div style="font-size:32px"><ol><li>one<li>two<li>three</div>
   <div style="font-size:48px"><ol><li>one<li>two<li>three</div>

we get a rendering that scales in a more natural and expected way (IMO) 
in response to font size changes.

This can of course be modified by an author (as above), but ISTM that a 
change to the default UA stylesheet would result in better default 
behavior for naive content. Is there any possibility we could make such 
a change, or is it likely it would break too many things?

JK
Received on Saturday, 22 February 2014 10:32:24 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 22 February 2014 10:32:28 UTC