Home Download Buy Blog Forum Support

HTML not linking to the CSS

HTML not linking to the CSS

Postby -Cesar- on Mon Aug 11, 2014 12:44 am

I have read the forum and have seen many people asking this question. When I try to link the CSS to the HTML it just doesn't do it. I am using a Mac. I have the two files in the same folder so it is not a path error (I have seen that many people have suggested that as the answer to the issue, but I can assure you it is not), and when I use any other editor to open the HTML it reads the CSS just fine.

Is this a known issue? please advise.

Thanks,


Cesar
-Cesar-
 
Posts: 4
Joined: Mon Aug 11, 2014 12:39 am

Re: HTML not linking to the CSS

Postby Orlmente on Mon Aug 11, 2014 12:41 pm

Sorry if it sounds a dumb question but:
what do you mean by "html not linking to the css"? supposing to talk about editor's features, what actions/behaviours do you expect from ST when you open an html file (I'm asking because you did mention opening html in "other editors")?
Orlmente
 
Posts: 99
Joined: Mon Mar 18, 2013 12:37 pm

Re: HTML not linking to the CSS

Postby -Cesar- on Mon Aug 11, 2014 2:29 pm

Oh no, it's a good question actually. After sending it I felt like I should have included more details. When I write the following:

In the index.html file:

<!DOCTYPE html>
<html>
<head>
<title>CSS not working</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<p>Hello World!</p>
</html>


And then the style.css file is:

body {
background-color: blue;
}


When I open the .html file in safari (or chrome) I see "Hello World!" with a white (not blue) background. Both files are in the same folder.
-Cesar-
 
Posts: 4
Joined: Mon Aug 11, 2014 12:39 am

Re: HTML not linking to the CSS

Postby -Cesar- on Tue Aug 12, 2014 3:40 am

Anybody?
-Cesar-
 
Posts: 4
Joined: Mon Aug 11, 2014 12:39 am

Re: HTML not linking to the CSS

Postby subhaze on Tue Aug 12, 2014 5:03 am

ST doesn't link style sheets to html, the browser does through the markup you provide. It seems that there is an issue with how the files are being served to the browser.
subhaze
 
Posts: 227
Joined: Tue Apr 09, 2013 3:22 am

Re: HTML not linking to the CSS

Postby soapybirds on Tue Aug 12, 2014 6:41 am

I can't replicate the error you're seeing, but the body end tag is missing in your HTML, which might be the cause.
soapybirds
 
Posts: 2
Joined: Tue Aug 12, 2014 6:38 am

Re: HTML not linking to the CSS

Postby -Cesar- on Tue Aug 12, 2014 11:41 pm

subhaze wrote:ST doesn't link style sheets to html, the browser does through the markup you provide. It seems that there is an issue with how the files are being served to the browser.


Is that a known issue? any way around it? I haven't been able to work from the mac and it's be awesome to have a workaround.

Edit: I just read your post correctly. When I do it with any other editor it works fine so I'm not sure if it's that.

soapybirds wrote:I can't replicate the error you're seeing, but the body end tag is missing in your HTML, which might be the cause.


Oops! I just wrote that in the forum as a way of simplifying the issue but all the end tags are properly coded in the actual file (I had to double check as I made that mistake here). Are you using PC or MAC? If you are using PC and cannot replicate the problem then it might be a MAC only issue.

Thanks for the replies! I hope I can get to the bottom of this.
-Cesar-
 
Posts: 4
Joined: Mon Aug 11, 2014 12:39 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 17 guests