[whatwg] <figure><img><* caption>

Tab Atkins Jr. wrote:
> On Tue, Dec 1, 2009 at 7:28 AM, Lachlan Hunt<lachlan.hunt at lachy.id.au>  wrote:
>> To some extent, it even makes it difficult for authors to provide reasonable
>> styles if they can't guarantee which elements content writers will choose
>> for their caption.  Imagine designing a CMS template with some default
>> styles for figure and caption, the CSS in the template would have to deal
>> with so many possible element choices just for the caption, it'll be
>> difficult to get it right and test everything.
>
> There are a multitude of "reset" style sheets on the web today that
> don't seem to have a problem removing virtually all default styling
> from elements.  It would not be difficult to modify one to strip a
> @caption element down to bare bones and then restyle as desired.

Applying reset styles alone and making all elements look the same 
basically defeats the purpose of being able to use a range of different 
elements, and is very likely not what an author would ultimately want.

Reset styles are just used to give different elements a more level 
playing field for new styles, and so authors would then still have to go 
through all the elements and style them appropriately for use as a 
caption.  Plus, authors have to worry about cascading issues from other 
styles in their own stylesheets.

Say, for instance, an author had applied special styles to paragraphs in 
some special type of section:

#foo p { margin-left: 1em; }

And then a content writer puts a figure in there using <p caption>, but 
the CSS author failed to adequately account for figures being used in 
that section, despite doing:

p[caption] { margin: 0; }

Due to specificity, the first rule would apply regardless and the 
caption would get a potentially unwanted margin.

I know there are ways to work around the issue, such as using !important 
or finding ways to increase the specificity of the latter selector, but 
the point is that introducing unnecessary element clashes creates 
needless complexities that should be avoided.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Tuesday, 1 December 2009 07:07:05 UTC