简体   繁体   English

如何在UltraEdit中将CSS链接到HTML?

[英]How to link CSS to HTML in UltraEdit?

I've just started using UltraEdit for coding in HTML and CSS on Mac. 我刚刚开始使用UltraEdit在Mac上以HTML和CSS进行编码。 (I am new to HTML, I've done only a little of it in Notepad++ on Windows.) (我是HTML的新手,在Windows的Notepad ++中,我只做了其中的一小部分。)

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. 问题是我无法将CSS文件附加到HTML文件,因此HTML可以正常工作(这是非常基本的),但是CSS并未应用于该文件。

The HTML and CSS files are in the same folder, so it should work as in Notepad++. HTML和CSS文件位于同一文件夹中,因此应像在Notepad ++中一样工作。

Here is my HTML file: 这是我的HTML文件:

<!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): CSS文件(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. 我已经对此进行了研究,但是所有编码人员都做同样的事情,并且在其他应用程序中也能正常工作。

Try to add your css code into the HTML file, as the following code. 尝试将CS​​S代码添加到HTML文件中,如下所示。

 <!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. 我还建议您将CSS文件重命名为“ dgt-2.css”,不要使用空格。 If that doesn't work, eliminate the cache of your browser or try another one, like: FIreFox, Chrome, or Explorer(as last resourse). 如果这不起作用,请消除浏览器的缓存,或尝试使用另一个浏览器,例如:FIreFox,Chrome或Explorer(作为最后的资源)。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM