[dokuwiki] Re: Request for an improvement - allow % sizes for images - please!

  • From: Chris G <cl@xxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 17 Feb 2011 22:01:56 +0000

On Thu, Feb 17, 2011 at 09:40:50PM +0100, Michael Haschke wrote:
> Hi,
> 
> 2011/2/17 Mike "Pomax" Kamermans <pomax@xxxxxxxxxxxxxxxxxxxx>:
> > Instead, the browser will load the image, sees that it's, say, 25000 pixels
> > by 10000 pixels, sees the CSS "width: 50%" rule, and proceeds to resize the
> > image as you instruct, downsizing it to 12500 x 5000 pixels. This is not
> > what you want, from what I can tell.
> 
> Wrong, the 50% leads to a size of 50% of the parental (block) element.
> Chris, just add a #content img {max-width:50%;} (or 100%, just like
> what you want) to your CSS, this will work as long as you don't use
> MSIE6-.
> 
Yes, this is my understanding of what the percentages mean, it also
seems to me to be what is described by the documentation at
http://www.htmlhelp.com/.  It applies to the HTML <IMG> as well:-

    Authors can also specify different dimensions for the WIDTH and
    HEIGHT attributes, in which case browsers should scale the image.
    Percentages, relative to the horizontal or vertical space available
    (not relative to the image's natural size) can also be specified,
    though these are not as widely supported as pixel lengths.

Note that "not relative to the image's natural size"!

-- 
Chris Green
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: