Testing simple css works and doesn't...

admin

Administrator
Staff member
Beginner level css:

Testing simple css works when I preview it in Dreamweaver (File -- Preview in Browser), but, just noticed when I close the htm file and open it through the directory (not Dreamweaver) -- CSS doesn't work.

Any suggestions? Thanks.

jamesDid you save the CSS in a separate file, or is it in-line?

If it is in a separate file, is the file in the right directory?My CSS file is in a separate file:

This is within the
<head>

<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"/style/main2.css">

</head>

I always preview in Dreamweaver and it works; but, again, when I close dreamweaver and open the htm page, the css is not recognized.

Also, when I open any page with CSS in Dreamweaver -- the CSS works, but when I click on a link to another page with CSS, the CSS is no longer recognized.Just found out that when I preview the htm page in Dreamweaver -- it's previewing (TMP5mvd0h93dy.htm) file (which I didn't create). Does TMP mean temporary file? It's reading the CSS okay. But when I open my file manually, through the directory -- the CSS is not recognized.<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"/style/main2.css">
This means that the file should be in a subdirectory called "style" that is in the root of the current drive. Is that where the file is? Does it contain only style information (i.e.: no HTML)?Yes, I have one file in /style/ subdirectory and it's called main2.css
No HTML files in the subdirectory

I deleted my temp files, restarted the computer, but still can't figure it out.

When I preview in Dreamweaver it previews some tmp9847569283476etc file and CSS works.
When I close Dreamweaver and open htm file manually -- CSS doesn't work.

I'll trash the folder and create a new one with the same name. Maybe there's something with the /style/ folder, because a while ago I had taken the main2.css out of the folder, but later brought it back in there.
---------
<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"/style/main2.css">

This means that the file should be in a subdirectory called "style" that is in the root of the current drive. Is that where the file is? Does it contain only style information (i.e.: no HTML)?I don't even know what it is, but Dreamweaver says:

"Cloaking lets you exclude specified folders and files from all site operations."

I have it check marked. Would that have to do anything with it?I don't really know DW all that well.

Sometimes the cache can mess you up. Hold down SHIFT and click on refresh so that it forces a reload.

Last ditch effort would be to move the css into the directory with the file and change the link.Dreamweaver previews the file by using the present directory as a sort of cache and creates and tempory file. this i think also prevents you from editing the hard copy via your web browser.

as for the css not rendering properly when the .css file is loaded. does any code appear? if not have you scrolled down. if not are you sure you are loading the hard copy file.

could we see an uploaded version of your stylesheet to check for errors if you are concerned..?

Best Wishes,
DavidI created a simple file with an external CSS and still does the same thing; previewing it with Dreamweaver displays reads the CSS OKay, but if I open the htm file -- the CSS is no longer recognized. The CSS is in the same directory as the htm file.
Here's my external CSS:
-----------------------

/* CSS Document */

.orange {
font-family: Geneva, Arial, Helvetica, sans-serif;
color: #FF6600;
font-size: 7pt;
line-height: 8pt;
letter-spacing: 1px;
text-decoration: none;


-----------------------
and Here's my htm file:
-----------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"/one.css">
</head>

<body class="orange">
text
</body>
</html>Are you referring to on the "Design" view. The page may look odd but when previewed or viewed live, it looks fine.I see the CSS is aplied on the design view and on File - Preview in browser as well; In both instances I get the orange text.

I save, I shut down Dreamweaver, I go to the directory where my one.css and rtrtrtr.htm files are. I open the rtrtrtr.htm file (not through Dreamweaver) and I get black text: the CSS is no longer being recognized.

By the way, on the previous message, I had forgotten the "}" at the end of the css code, but with and without it - it still didn't change anything.

I might just quit on this one and make it an internal css - it works as internal: I tested it. But if anyone knows why I had that problem - I'd be glad to know the answer. Thanks.

jamesits probably a problem with your importing the stylesheet. dreamweaver fails to notice this whereas a seperate browser does.

remove the / from the begining. so it wouldnow be:
<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"one.css">

the / makes the browser search the root folder so if you are viewing this locally. it will go to your eith root drive C: or your servers root directory.

Best Wishes,
Davidremoving the "/" solved the problem! Thanks.

jamesNo Problem. Glad to Help!

Best Wishes,
David
 
Back
Top