/    Sign up×
Community /Pin to ProfileBookmark

IE stretches my IMG – why?

My page works like a dream in Firefox. [B]However, IE 7/8 stretches my image vertically [/B]when I want to keep proportions with the width, which I set at 450px in the CSS.

I made a page using the 960grid CSS layou, which I’ve found to be mostly useful and without annoyance.

There are three container DIVs for main content:

1) Sidebar.
2) Thumbnails.
And 3) that one is there for a jQuery plugin (galleria) to display an image inside [B]div ID = “mainimage”[/B].

The DIVs are styled by CSS.

Fragment of DOM structure:

[CODE] <div class=”container_12″>
<div class=”grid_12″ id=”header”>
</div>
<div class=”clear”>
</div>
<div class=”grid_12″ id=”navbar”>
</div>
<div class=”clear”>
</div>
<div class=”grid_12 filler20″>
</div>
<div class=”clear”>
</div>
<div class=”grid_3″ id=”leftbar”>
<div>
</div>
</div>
<div class=”grid_3″ id=”thumbs”>
</div>
<div class=”grid_6″>
<div id=”mainimage”>
</div>
<div>
</div>
</div>
<div class=”clear”>
</div>
<div class=”grid_12 filler20″>
</div>
<div class=”clear”>
</div>
<div class=”grid_12″ id=”footer”>
<div class=”grid_4 alpha”>
</div>
<div class=”grid_4″>
</div>
<div class=”grid_4 omega”>
</div>
</div>
<div class=”clear”>
</div>[/CODE]

See [URL=”http:/www.andrewcolvinart.co.uk/dev/exhibitions.php”]my dev site[/URL] (yes I know it’s slow…) that’s artists’ Jpegs for you.

Any helpful ideas will be gratefully received as this page is desperately needed.

Dizz

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@DizzleyauthorOct 07.2009 — So I was thinking... have I actually asked a CSS problem? Did I ask in the right forum? :o

It's all about how IE renders an IMG with width=450px and height not specified... in the case of my page.

I have IMGs of various widths and heights and want to fit them neatly into my 460px wide DIV.

Off to sleep now... see you tomorrow.
Copy linkTweet thisAlerts:
@opifexOct 09.2009 — From what I see, it's all about how part of most of the images stays past the bottom of my screen! and I was looking at the page using firefox.

This might be causing a couple of problems.....
[code=html]
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin : 0;
padding : 0;
border : 0;
outline : 0;
font-size : 100%;
vertical-align : baseline;
background : transparent;
}
[/code]


and jQuery is over-riding this

[code=html]

#mainimage {
position : absolute;
top : 0;
right : 0;
width : 460px;
} [/code]

with
[code=html]

$(window).scroll(function()[/code]


... and don't blame the "artists" for the file sizes or how many images are on ine page... the person making the page should optimize them and find the best method for optimal presentation.

Grid + jQuery is not the optimal solution in this particular case.
Copy linkTweet thisAlerts:
@DizzleyauthorOct 09.2009 — @opifex

Sorry if I confused you - I had moved on from the original problem and had edited the file - what you saw at the link was only half done, so it did look awful.

[U]A discussion of the original problem:[/U]

The finished site will take many images whose size would be outside my control. My customer wants to make lots of changes to the pictures and so I devised a quick and dirty method for uploading them to the site. Later, I will move to a CMS to provide a better customer experience.

exhibitions.php is a typical page that may display such a dynamic picture gallery.

The image stretch problem was caused by [B]specifying WIDTH[/B]=460px in the IMG, [B]but not specifying HEIGHT[/B]. Firefox resizes the images just fine, but IE chooses to keep the image's real height. - The HTML spec says it's up to the browser what to do in this case.

So I now resize all images before presenting them to 460px wide and generate a thumbnail for them. (Am I fulfilling my duties better now??)

[U]The scrolling:[/U]

What you saw was not finished and was just an exercise. It now scrolls very nicely thank you. The customer (and artists) like the clean design of the tall list of thumbnails. When you scroll the document down to see more thumbnails, the present main image scrolls down and remains centred on the page.

If you look now it should be much better. I'll point you to the LIVE page now so it won't look so wrong. Yes, I know there are things I can do better, but that will come in Version 2 based on the CMS, which will give me the user features I would otherwise have to write.

[U]Grid960 and jQuery got me from zero to a working gallery site in good speed.[/U]

Grid? - That was OK to get the project off the ground.

jQuery - That helped me with a choice of ready-made gallery components that I could show my customer. It's good across the browsers and it made scrolling of widgets a real breeze. You just have to be aware of how it works so you don't shoe-horn the browser into doing things the hard way.

Thanks for casting an eye over things.
Copy linkTweet thisAlerts:
@DizzleyauthorOct 09.2009 — The CSS you saw:
[CODE]html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin : 0;
padding : 0;
border : 0;
outline : 0;
font-size : 100&#37;;
vertical-align : baseline;
background : transparent;
} [/CODE]

is part of a reset.css file I use. It's meant to be overridden.

Thx.
×

Success!

Help @Dizzley spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...