How to link CSS to HTML in UltraEdit?

230 Views Asked by At

I've just started using UltraEdit for coding in HTML and CSS on Mac. (I am new to HTML, I've done only a little of it in Notepad++ on Windows.)

The problem is that I can not attach my CSS file to my HTML file, so HTML does work (it is very basic), but CSS is not applied to it.

The HTML and CSS files are in the same folder, so it should work as in Notepad++.

Here is my HTML file:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="dgt 2.css">
</head>
<body>

<h1>My HTML file</h1>

</body>
</html>

CSS file (dgt 2.css):

h1 {
    color: green;
}

So, as you see it is all very straightforward, but I don't know why the heading is not green.

I've researched on that, but all coders do the same thing and it does work in other apps.

1

There are 1 best solutions below

3
On

Try to add your css code into the HTML file, as the following code.

<!DOCTYPE html>
<html>
<head>
<style>
h1{
color: green;
} 
h2{
color: rgb(201, 76, 76); 
}
</style>
</head>
<body>

<h1>My HTML file</h1> 
<h2>CSS</h2>

</body>
</html>

I Also recommend you to rename the CSS file to "dgt-2.css", with no spaces. If that doesn't work, eliminate the cache of your browser or try another one, like: FIreFox, Chrome, or Explorer(as last resourse).

<link rel="stylesheet" type="text/css" href="dgt-2.css">