Forum Moderators: not2easy

Message Too Old, No Replies

CSS Weirdness

         

photozen

11:03 pm on May 3, 2007 (gmt 0)

10+ Year Member



Hi All,

I've got a small test page that uses an @import url(stylesheetname.css); to load the appropriate styles. If I move all the style definitions into the HTML file the page renders as expected. If I load via @import, the body and #wrapper definitions don't seem to kick in. If I move these two into the HTML file they work fine. Any help will be great. TIA. Here's the HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<style type="text/css">
@import url(Styles/new1.css);
</style>
</head>
<body>
<div id="wrapper">
<div class="pagetitle">
<p>Page Title Here</p>
</div>
</div>
</body>
</html>

Here's the CSS:

<style type="text/css">

body
{
margin: 0;
padding: 0;
background-color: #555555;
color: black;
font: small Arial;
font-size: 8pt;
}

#wrapper
{
background-color: #ffffff;
color: black;
margin: 15px 15px 15px 15px;
padding: 2px;
}

.pagetitle
{
color : #ffffff;
background-color: #afafaf;
font-family : Tahoma;
font-size : 10pt;
font-weight : bold;
text-align : left;
height : 20px;
vertical-align : middle;
padding-left : 5px;
background-image : url(../Media/bluegr.gif);
background-repeat : repeat-y;
position: relative;
}
.pagetitle p
{
float: left
}
</style>

Robin_reala

6:39 am on May 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi photozen, welcome to WebmasterWorld

Everything in your code looks OK. Perhaps this is a MIME type issue? If you go directly to your stylesheet in Firefox and select Tools / Page Info what does the Type field say? It should be text/css - if it’s anything else then it won’t work.

photozen

5:55 pm on May 4, 2007 (gmt 0)

10+ Year Member



thanks for the response robin reala.

If I view page info for the html page it is 'text/html' I would assume that the page type for the css file should be 'text/css', but don't know where to find it in Firefox.

Robin_reala

6:14 pm on May 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You’d need to paste the URL to the CSS file directly into the address bar. For example, if your css is at http://www.example.com/my_css.css then if you put that into the address bar and view the page info you should see the type.