XHTML: CSS does not display?
-
30-04-2021 - |
Вопрос
Not sure entirely what is happening, but I get the following errors from Internet Explorer and Google Chrome...yet it displays perfectly in Opera >_>
This XML file does not appear to have any style information associated with it. The document tree is shown below.
IE
IE renders the page but doesn't apply ANY of the tags and just displays the text >_>
Code
XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!-- This is a redesign of my redesign -->
<html>
<head>
<title>Hello</title>
<link rel="stylesheet" type="text/css" href="css/fonts.css" />
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link rel="stylesheet" type="text/css" href="css/container.css"/>
<link rel="stylesheet" type="text/css" href="css/banner.css" />
</head>
<body>
<div id="Container">
<div id="Banner"></div>
<div id="Content"><p>Hello World</p></div>
</div>
</body>
</html>
CSS Example
@charset “UTF-8?";
/*CSS for the Container and non div items*/
#Container {
width: 80%;
min-height: 600px;
max-height: 1200px;
margin: 0 auto;
margin-top: 1%;
z-index: 0;
}
#Content {
position: relative;
width: 100%;
min-height: 70%;
height: 80%;
max-height: 80%;
background-color: red;
z-index: 2;
border-style: solid;
border-left-width: 1px;
border-right-width: 1px;
border-color: black;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
What gives O_o
Решение
An XHTML file MUST have the xmlns attribute xmlns="http://www.w3.org/1999/xhtml"
in its html start tag or it will not be recognised as XHTML.
Opera's behaviour is non-standard.
Другие советы
The first line in your CSS file looks wrong:
@charset “UTF-8?;
Should probably be:
@charset "UTF-8";
Не связан с StackOverflow