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

Re: CSS vs. img size attributes

From: Simon Pieters <simonp@opera.com>
Date: Tue, 25 Nov 2014 11:45:16 +0100
To: "www-style list" <www-style@w3.org>, "Henrik Andersson" <henke@henke37.cjb.net>
Message-ID: <op.xpvmtqg3idj3kv@simons-macbook-pro.local>
On Tue, 25 Nov 2014 09:34:35 +0100, Henrik Andersson  
<henke@henke37.cjb.net> wrote:

> Is there a clear specification that rules on which takes precedence, CSS
> or explicit width and height attributes of an <img> element in a HTML
> document?

https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
->
https://html.spec.whatwg.org/multipage/rendering.html#maps-to-the-dimension-property
->
https://html.spec.whatwg.org/multipage/rendering.html#presentational-hints

Your CSS rules using width and height properties win over <img width  
height> presentational hints.

> The same goes for any replaced element: what if the replacing content
> has a set size in the DOM? Or for that matter, if it has an intrinsic  
> size.

http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width
http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height

-- 
Simon Pieters
Opera Software
Received on Tuesday, 25 November 2014 10:44:58 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:26 UTC