benbob
August 13, 2012, 1:26pm
1
Something going wrong with my new xhtmlpage not seeing or reacting to my stylesheet.
I suspect I somehow got the path wrong, but maybe it is something else. I’ve tried about a dozen different solutions, but nada. Looked in my textbooks and still can’t see where I go wrong. Grrrrrrrr, I hate looking thick.
stylesheet content (only for test purposes): Body {background-color: red; }
stylesheet name: xtmlstylesheet.css
webpageaddress: http://www.boiler-breakdown-repair-london.co.uk/emergency-waterleak-repairs-southeat-london.xhtml
link and position in head of xhtlmpage:
<head>
<link rel=“xtmlstylesheet” type=“text/css” href=“http://www.boiler-breakdown-repair-london.co.uk/xtmlstylesheet.css ” />
<title>Emergency waterleak repairs in southeast London</title>
<meta name=“keywords” content=“waterleak, repair, southeast London, emergency”/>
<meta name=“Description” content=“Emergency waterleak repairs in southeast London”/>
<meta http-equiv=“Content-Type” content=“text/html;charset=utf-8”/>
<meta name=“geo.region” content=“UK”/>
<meta name=“geo.placename” content=“London”/>
<meta name=“geo.position” content=“51.427364;-0.160074”/>
</head>
The other weird thing, is that the page displays fine (albeit with default background-color and not in red) in Opera, Firefox and Chrome. But when I copy/paste the address in the Internet Explorer addressbar, it starts up Firefox and displays the page as it is located on my harddisk, and never changes the homepage in I.E.
This is harder than I thought.
Why does it not see my stylesheet and why does I.E. refuse to display it and start up firefox???
ralphm
August 13, 2012, 1:37pm
2
Your style sheet doesn’t work because you have an error in red below:
<link rel="[COLOR="#FF0000"]xtmlstylesheet[/COLOR]" type="text/css" href="http://www.boiler-breakdown-repair-london.co.uk/xtmlstylesheet.css" />
It should just read
<link rel="[COLOR="#FF0000"]stylesheet[/COLOR]" type="text/css" href="http://www.boiler-breakdown-repair-london.co.uk/xtmlstylesheet.css" />
The problem with IE may have something to do with the xml declaration at the top, which doesn’t belong there, and which throws some versions of IE into chaos:
<?xml version="1.0" ?>
Remove that, and clear any spaces before the doctype. See if that helps.
benbob
August 13, 2012, 2:17pm
3
Thanks Ralph
I changed it into the following, but strangely enough it doesn’t make any difference in either display or the way I.E. reacts.
I’ve cleared up the spaces, just in case, but that made no difference either.
stylesheet content =
Body {color: red; }
(just line 1, nothing before, nothing after)
xhtmlpage content:
<!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>
<link rel=“stylesheet” type=“text/css” href=“http://boiler-breakdown-repair-london.co.uk/xtmlstylesheet.css ” />
<title>Emergency waterleak repairs in southeast London</title>
<meta name=“keywords” content=“waterleak, repair, southeast London, emergency”/>
<meta name=“Description” content=“Emergency waterleak repairs in southeast London”/>
<meta http-equiv=“Content-Type” content=“text/html;charset=utf-8”/>
<meta name=“geo.region” content=“UK”/>
<meta name=“geo.placename” content=“London”/>
<meta name=“geo.position” content=“51.427364;-0.160074”/>
</head>
<body>
<h1>Southeast London emergency waterleak repairs</h1>
<p><strong>Emergency waterleak repairs in southeast London</strong> is one of the key services …
…</p>
</body>
</html>
benbob
August 13, 2012, 2:24pm
4
ralphm
August 13, 2012, 2:30pm
5
Because you are using a strict XHTML doctype, it’s probably because your style reads
[COLOR="#FF0000"]B[/COLOR]ody {color: red; }
instead of
[COLOR="#ff0000"]b[/COLOR]ody {color: red; }
As a rule, never use capitals in code. It’s just asking for trouble.
benbob
August 13, 2012, 2:56pm
6
NOTE:
Just spotted a typo in the url: the “s” was missing and it was called “southeat” instead of “southeaSt”.
Now rectified so old link in this post may not work
benbob
August 13, 2012, 3:02pm
7
Eureka, that’s it. B instead of b.
Ralph, saviour of the universe.
Or at least of my sanity. Maybe not as grand, but as important to me.
Pffffffff, this “strict” stuff may be good for coding discipline, it’s costing me a year of my life.
ralphm
August 13, 2012, 11:41pm
8
Yes, there are so many potential typos that I at least keep everything lowercase to avoid this problem. URLs, class/id names, element tags etc.