External style sheet in CoffeeCup...

User 2664381 Photo


Registered User
6 posts

Folks, I am trying to learn from scratch so I am quite at sea. I have had a search on my difficulty but not found why - probably because it's so simple!

I am using the W3Schools.com tutorials to learn and trying to get simple code working in CoffeeCup HTML Editor. I want to follow advice and put my css commands in a separate file.

But I just can't get it working. In the header of the trial html page I have:

<head>
<link rel="stylesheet" href="stylesheets/trialstyles.css" type="text/css">
</head>

The file 'trialstyles.css' is, in it's entirity:
/* Default CSS */
/* Generated by the CoffeeCup HTML Editor - www.coffeecup.com */
body { background-color:#0000CF; }
p {margin-left:20px; color:#009933;}

I used the pale orange and grey spanner icon to check the Project Website Dependencies and it was fine. (And when I purposely mis-spelt the 'trialstyles.css' file name it did find the error). Sadly the background-color:#0000CF did not come through in the lower pane of the CoffeeCup HTML Editor when I pressed F12.

I copied the commands 'body { ....' etc into the trial html page head and then the background colour did change in the display pane:
<head>
<style>
body { background-color:#0000CF; }
p {margin-left:20px; color:#009933;}
</style>
</head>

So what have I done wrong? Thanks, Ed
User 187934 Photo


Senior Advisor
20,271 posts

Make sure your external style sheet doesn't have these tags in it.
<style>
</style>
It should only be

body { background-color:#0000CF; }
p {margin-left:20px; color:#009933;}

I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 122279 Photo


Senior Advisor
14,649 posts
Online Now

... nor the <head></head> tags...
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 603315 Photo


Registered User
938 posts

User 2088758 Photo


Senior Advisor
3,121 posts

I will forth that resolution. The only time tags are needed with css is when they are used directly on the page.
Taking over the world one website at a time!

Steve Kolish
www.misterwebguy.com

YouTube Channel:
https://www.youtube.com/channel/UCL8qVv … ttneYaMSJA
User 122279 Photo


Senior Advisor
14,649 posts
Online Now

Steve wrote:
I will forth that resolution. The only time tags are needed with css is when they are used directly on the page.

Yes, in the page head ;)
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 2664381 Photo


Registered User
6 posts

Thanks for the responses. I'm a bit confused still. I said in my post that I listed the file 'trialstyles.css' in its entirity. Note that it does not have any tags in it, just 2 comment lines and the 2 code lines that Eric said should be there.

The code with tags later in my post were included to show that when I put these 2 code lines into the page header they did change the display pane correctly, but when they were in the linked css file they did not.

So I'm still at sea folks! Sorry.
User 187934 Photo


Senior Advisor
20,271 posts

Where is your style sheet in relation to your page?
If the page is in the root of your site then the style sheet would be in a folder called stylesheets.
<link rel="stylesheet" href="stylesheets/trialstyles.css" type="text/css">

mypage.html
stylesheets/trialstyles.css
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2664381 Photo


Registered User
6 posts

Yes Eric that's exactly how the files are stored. I believe the check using Project Website Dependencies that I mentioned confirms it. I've just tried moving the trialstyles.css file and indeed Project Website Dependencies highlighted that there was a problem.
User 187934 Photo


Senior Advisor
20,271 posts

How about a link to the page?:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

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.