Groups > Browsers > Opera page authoring > Re: oddity with images in tables




oddity with images in tables

oddity with images in tables
Wed, 01 Nov 2006 17:54:39 -050
I've noticed an odd behavior with tables and images.

If a table contains an image whose height and width is constrained with 
style max-height and max-width, the table border adjusts to the new 
height of the image, but not the new width.  This html illustrates the 
problem if image.jpg is suitably large:

<table border="1"><tr><td>
<img src="image.jpg">

</td></tr></table><br><br>
<table border="1"><tr><td>
<img src="image.jpg" style="max-height:100px; max-width:100px;

padding-right:0px">
</td></tr></table>

an  example is at http://www.folsoms.net/table_issue.htm

I see this behavior on Opera 9 for both windows and Mac.

Any idea what's going on, or how to get around it?

Thanks

Post Reply
Re: oddity with images in tables
Thu, 02 Nov 2006 13:37:22 +000
Alan Folsom <allanfolsom@comcast.net> wrote:

>I've noticed an odd behavior with tables and images.
>
>If a table contains an image whose height and width is constrained with 
>style max-height and max-width, the table border adjusts to the new 
>height of the image, but not the new width.  This html illustrates the 
>problem if image.jpg is suitably large:
>
><table border="1"><tr><td>
><img src="image.jpg">
>
></td></tr></table><br><br>
><table border="1"><tr><td>
><img src="image.jpg" style="max-height:100px;
max-width:100px; 
>padding-right:0px">
></td></tr></table>
>
>an  example is at http://www.folsoms.net/table_issue.htm
>
>I see this behavior on Opera 9 for both windows and Mac.
>
>Any idea what's going on

Afaik the CSS spec does not specify which of the two width calculations
should occur first, that means that browsers are free to calculate and
apply max-width constraints after the table width has been calculated
and applied.

>, or how to get around it?

It's difficult to give advice since you have not demonstrated what it is
that you are actually trying to achieve. Generally it is a bad idea to
let a browser resize an image, they do a poor job.

-- 
Post Reply
Re: oddity with images in tables
02 Nov 2006 18:21:55 GMT
Spartanicus <invalid@invalid.invalid> wrote in
news:8qsjk2pi91edc435c32oaoo8iomi503870@4ax.com: 

>>an  example is at http://www.folsoms.net/table_issue.htm
>>
>>I see this behavior on Opera 9 for both windows and Mac.
>>
>>Any idea what's going on
> 
> Afaik the CSS spec does not specify which of the two width
> calculations should occur first, that means that browsers are free to
> calculate and apply max-width constraints after the table width has
> been calculated and applied.

That's a bit disingenous isn't it?  There is a definate difference
between a legal implementation and a good one. Undefined behavior to a C
compiler could be anything, though I would suspect users would complain
if their computers caught fire.  Or, I may be free to dump my trash on
the floor, but that doesn't mean it's the right thing to do. 
> 
>>, or how to get around it?
> 
> It's difficult to give advice since you have not demonstrated what it
> is that you are actually trying to achieve. Generally it is a bad idea
> to let a browser resize an image, they do a poor job.

I thought the example demonstrated exactly what I was trying to achieve
-  and what both Firefox and IE do - shrink the area needed to display
the image.  While it may be a "bad idea" to let browsers shrink
images,
I need to display random images from users, and not allow them to exceed
a certain amount of screen real-estate.  I suppose I could spawn off a
program to create a new image, but that seems excessive when browsers
Post Reply
Re: oddity with images in tables
Thu, 02 Nov 2006 18:40:42 -050
Spartanicus wrote:
> Nothing "disingenuous" about it, I'm simply stating what I
believe to be
> the case (although I haven't extensively checked the spec).

Why is it that every newsgroup has a self-important idiot who feels his 
role in life is to put down anyone else who attempts to get help? 
Somehow your gorilla posturing and chest-thumping would be more 
impressive if you had actual knowledge, or the humility to check your 
facts before pontificating, rather than just a "belief".
> 
>>There is a definate difference
>>between a legal implementation and a good one.
> 
> 
> You seem to have decided on using a bizarre construct for an undisclosed
> reason which as far as can be determined does not appear to be the
> produce of proper authoring. You then imagined a certain browser
> behaviour that would suit you which isn't supported by the governing
> specification, and then you decide that the browser is to blame for not
> guessing your desired behaviour if it doesn't work as you would like it
> to. That's more than a bit rich.

Apparently the other poster does believe it is covered by the governing 
specification.  But then, he may have actually looked at them.

It is not a bizarre construct.  It is the use of a simple and well 
documented feature in CSS that should, at least, behave in a predictable 
manner.  A reasonable manner would be even better.  Since tables 
normally shrink to fit their content, it would be reasonable to expect 
that to happen.

I expect browsers to perform in reasonable manner.  Reasonable in the 
sense of doing what users expect them to do, rather than reasonable in a 
anal-retentive language-lawyer sense.  I need to develop software that 
does what my customer requires, and works on any major browser out 
there. I stubbornly try to include Opera in that category of major 
browsers.  With attitudes such as yours I can see why that is becoming 
more and more difficult.

I have used Opera through more revisions than I can remember, and paid 
for it on three different occasions before it became free.  I use it and 
advocate it continuously, but pompous responses by self-important little 
men does no help at all in that effort.

> 
> Ok, so you have no intention of disclosing what you are actually trying
> to do. Good luck with that strategy.
> 

I suppose I could post pages of PHP code to show exactly what I was 
doing, but besides obfuscating rather than ilustrating the issue, it 
might actually annoy the customer who expects me to keep my work for him 
confidential.  Imagine that, actually trying to reduce some issue to a 
simple illustration before asking for help.  How unreasonable of me.

Your arrogant and pretentious persona may intimidate somebody, but I 
have been developing software professionally since 1979.  In those 27 
years of experience I've learned that customers are rarely impressed 
with a smart-ass developer who hides behind technicalities to explain 
why their product doesn't behave as any user would expect it to.

Post Reply
Re: oddity with images in tables
Thu, 02 Nov 2006 19:49:33 +010
On Thu, 02 Nov 2006 19:21:55 +0100, Alan Folsom <folsom@jmisoftware.com> 

wrote:

>>> an  example is at http://www.folsoms.net/table_issue.htm
>>>
>>> I see this behavior on Opera 9 for both windows and Mac.
>>>
>>> Any idea what's going on
>>
>> Afaik the CSS spec does not specify which of the two width
>> calculations should occur first, that means that browsers are free to
>> calculate and apply max-width constraints after the table width has
>> been calculated and applied.

Opera is having no trouble applying the max-width and max-height to the  
picture. In fact, playing with the source and "Reload from Cache", I
could  
keep resizing the picture with no problems whatsoever. The big batch of  
CSS at the beginning isn't even used and removing it has no effect on the  
issue.

CSS does however stipulate that the "table-cell" and "table"
display  
styles are shrink-to-fit, which this one is clearly not doing. This looks  
like a pretty clear re-flow problem to me.

I posted the test page to a similar issue in the Opera bug tracking  
database.

-- 
Post Reply
<< Previous 1 2 3 Next >>
( Page 1 of 3 )
about | contact