Forum Moderators: not2easy
On my offline LAMP setup, the background image displays in Firefox fine. Using the same Firefox, with the same directory structure, and the same files, but using the online server, the background image does not display.
Hovering the image url as displayed in Firebug, the image appears, so the image location isn't wrong. I tried Safari and Opera in Windows and Safari alone displays the background image.
I feel like I must be missing something unbelievably basic, but it has yet to present itself to me.
Here's the HTML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>exampe</title>
<link rel="stylesheet" type="text/css" href="/test2.css" />
</head>
<body>
<div id="background">©
</div>
</body>
</html>
And here's the CSS:
div#background
{
width: 640px;
height: 500px;background: url('/images/front/spried.png') no-repeat center bottom;
}
I tried it without single quotes in the url, and without the leading slash, among other things.
If anyone has any clues or ideas I might be able to pursue, I would greatly appreciate it.
[edited by: swa66 at 8:21 am (utc) on Oct. 1, 2009]
[edit reason] specifics removed [/edit]
Parse error: syntax error, unexpected T_STRING in /home/.identifier/d_blackwell/example.com/xhtml-issue.html on line 1
I wonder if the DTD, specifically the xml prologue is an issue? Remove the prologue line and test.
<?xml version="1.0" encoding="UTF-8"?>
Of course, if not served properly, the HTML is probably a better choice
Note: The <title> contains a specific identifier to the website in question and I can see that the page (at least the home page) is not rendering. It could be removed by a moderator.
Guide to Posting...
3. Remove any specifics, email addresses or passwordsPlease make the posted code as generic as possible and remove or change specifics that identify your site...
I assume the line you're talking about is the <?xml ?> one? I just tried that and the results were the same. I also got rid of the "xmlns" property, since that was the default and I might have mis-typed it or something.
That error looks like a PHP error - what diagonistic did you do to get that?
The code is now:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="/test2.css" />
</head>
<body>
<div id="background">©
</div>
</body>
</html>
Do you think it is a server setup issue? I could contact tech support if that is true... but I thought since the source displayed in the browser was the same online/offline (I diff'ed them) the browser would handle them exactly the same.
@rendaw
Removing the namespace definition in xhtml is however not the right move IMHO, it should be there, while IE (all versions) still don't support namespaces, other browsers do in fact support it.
Try using a validator to make sure your code is valid.
[validator.w3.org...]
To find your problem:
Check for mime-type issues.
Locally a file format is recognized differently than when the file is served by a http server.
The mapping of extension to mime-type in apache is done by a mime.types file in the conf directory, check that it has image/png for png files.
And check that your file is in fact a png encoded file if you name it png and have that configuration.
Also clear your caches.
@D_Blackwell:
If you get a php error on the preamble, it means the server is setup to parse PHP on the short <? tag as well as the longer <?php version. php.ini should be able to turn that off if your do not needed in the rest of your site.
What you need is:
short_open_tag = Off
And thanks for the suggestion about the the XMLNS. I thought that it was a default, rather than a fallback. I fixed that too.
Anyways, thanks again. Not fixed yet, but with perseverence, maybe.