views:

170

answers:

2

Having CSS layout issues with Internet Explorer 7 (big surprise). Upon using the Developer Tools to inspect the CSS, I discovered that some properties defined in the stylesheet are not appearing in the parsed CSS structure... THEN I saw THIS being shown as the parsed value for the background-image property:

background-image : url(/trunk/httpdocs/images/layout/HCBL_Homepage_01.jpg); WIDTH: 1200px;

pretty much obliterating the width property that was defined.

The actual code in the CSS file for this element:

div#header {
        width: 1200px;
        height: 100px;
        margin-left: auto;
        margin-right: auto;
        background-image: url('/trunk/httpdocs/images/layout/HCBL_Homepage_01.jpg');
        background-repeat: no-repeat;
}

If anyone could offer any insight, or provide a link describing this problem (and maybe a workaround...) I would be very appreciative.

Also, I am only interested in this from a parsing of the stylesheet and CSS syntax perspective. I am not concerned with rendering and display issues at the moment; I simply want to get IE 7 (and I have a feeling IE 6 will have similar issues) to recognize and parse ALL of the CSS properties that have been defined in the stylesheet.

Also, here is a link to some static HTML and CSS that illustrates the problem described.

Thanks in advance guys!

A: 

Are you sure that you have regular inverted commas around you url, not fancy curly ones? Do you get the same behaviour if you change them to quote marks?

graphicdivine
They are regular single-quotes, not backquotes or double-quotes. The same behavior appears with and without quotes.
rixin
Are you in quirks mode by any chance?
graphicdivine
IE7 Standards Mode is what I have set right now.
rixin
You don't even need the quotes, that's what the brackets are for.
Diodeus
Yes, I am aware that the quotes are optional. But the same thing happens regardless of whether there are quotes or not.
rixin
You might have 'set' standards mode, but something else might be triggering quirks mode. What doctype are you using. Can we see the actual live page?
graphicdivine
The doctype declaration is:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">And I will look into putting the page up somewhere if possible, but it is not hosted other than on my development machine at the moment.
rixin
Here is a link to a some HTML and CSS that illustrates the problem:http://bonitabr.com/public/layout_proto.htmlIt is somewhat simplified, in terms of just being static HTML (the actual page is dynamically generated), however the issue at hand is still exemplified by this page. I hope this gives a bit more context to the problem, and thank you for your responses thus far, it is very much appreciated.
rixin
I see. Thanks. Interesting. I suspect that this is a bug in the Developer Tools, though, rather than in IE itself, since it appears to honour both the background image and width rules, doesn't it?
graphicdivine
I see what you mean now. At first I wasn't surprised it honored the part of the background-image property that was being read, and I was thinking that some of the other CSS properties were getting "clobbered" so to speak by some error in parsing that property. However, what you say could very well be a possibility and I'm into it further now. After I read your last comment I also loaded jQuery and executed the following in the Developer Tools console: $('div#statusArea').css('position'); It returned 'absolute' which is what is set in the stylesheet. If it's removed, it returns 'static'.
rixin
A: 

I'm not 100% about your folder structure or how you are accessing your image but have you tried without the first slash or adding .. before the first slash?

Where are the CSS and JPG files located from your website's root directory?

Jonathan Czitkovics
It finds and displays the images just fine. It is the fact that the background-image property seems to be consuming other properties as part of it during the parsing process. So the resulting problem is really that not all the CSS properties are being applied to the elements despite being defined in the stylesheet, thus causing the layout issues right now.
rixin