Problem previewing external Style Sheet.

User 443832 Photo


Registered User
3 posts

Morning all,

I'm a new-bee to CSS and I'm not sure if I'm doing this right.

I'm trying to preview the layout I've constructed in the HTML editor, but am having no luck.

Below is start of HTML:

<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<link type="text/css" media="screen" rel="stylesheet" href="/working/cammells.css">
</link>
</head>
<body>

<div id="wrapper">
<div id="banner">

I've saved a CSS file called cammells.css in the working folder, and link to it in the HTML. This First part should bring up a banner section that is slightly coloured - but when I preview it I cant see a thing.

What am I doing wrong?

CSS is below:

* {
border:0pt none;
margin:0pt;
padding:0pt;
}
body {
background-color:white;
}
#wrapper {
height:100%;
margin:0pt auto;
padding:0px;
position:relative;
width:800px;
}
#banner {
background-color:#FFFFFA;
height:200px;
left:0px;
width:100%;
position:absolute;
right:0px;
top:0px;
}

#menu {
width:200px;
background-color:#FFFFFB
}

#content {
margin-left:200px;
background-colour:#FFFFFC

Any help appreciated,

Mike.
User 463058 Photo


Ambassador
1,080 posts

href="/working/cammells.css"

If viewed locally this is telling the browser to look for cammells.css in the "working" folder located in your hard drive's root. Is this where you want it to be looking?
User 122279 Photo


Senior Advisor
14,547 posts

How did you preview your css? Did you preview the actual css file, or did you preview the html file that has the link to the css file?

There are a couple of things that you ought to change in the css file:

Add a } at the end.
Change the background colour to a visible one - at least for testing.

As Cary said above, it also depends on where your css file and the html file are stored, relatively. If the html file is stored in your 'working' folder (the default in all CC progs,) and the css file is in the same folder, you just give the file name in your path, like href="cammells.css". But if your html file is saved outside the 'working folder' the path is href="working/cammells.css", without the initial /.

When previewing just the css file, you won't see much, just the body background colour and the fonts. In the html file, if you have defined the wrapper, menu etc correctly, you should be able to see the effects of the css.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 443832 Photo


Registered User
3 posts

Thanks for the help, have solved the problem and am on to the next one!

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.