繁体   English   中英

将CSS文件链接到HTML是否有问题?

[英]Is there a problem linking CSS file to HTML?

关于我要做什么的一些背景知识-从最近开始,我开始阅读Jon Ducketts的《 HTML&CSS》一书,对此我感到很满意。 我完成了HTML,现在开始本书的CSS方面。

我要完成的工作是创建一个网站,以显示本书所涵盖的所有内容,并且本质上具有导航栏,以使用户可以更轻松地访问我的网站,以了解尚不清楚的主题(我自己)。
问题是,当我尝试设置文本颜色的样式时, 颜色并没有改变,而且对我而言,我无法弄清楚为什么。
我的链接中的问题是在标题中指定了错误的文件路径,还是在HTML和CSS中设置类的问题?

我的CSS代码位于尝试创建类的页面的底部。 由于您需要“ 10信誉”才能发布照片,因此我将在此处编写HTML / CSS文件名和文件夹路径。

名称-newWebsiteFinalCSS.css文件夹路径-C:\\ Users \\ MyName \\ Desktop \\ Website

名称-newWebsiteFinal.html文件夹路径-C:\\ Users \\ MyName \\ Desktop \\ Website

 .headingcolors { color: red; } .p { color: red; } 
 <!doctype> <html> <head> <title>Final HTML CSS Website</title> <link type="text/css" href="Website/newWebsiteFinalCSS.css" rel="stylesheet"> </head> <!-- This section i want to create a link to different topics within my own website so it is easier to go throughout the site and only look at things you want to be reasearching about if you come across a problem with a topic about HTML or CSS. --> <header class="topnav"> <a href="#home">Home</a> <a href="#text">Text</a> <a href="#lists">Lists</a> <a href="#links">Links</a> <a href="#images">Images</a> <a href="#tables">Tables</a> <a href="#forms">Forms</a> <a href="#extramarkup">Extra Markup</a> </header> <!-- insert navigation bar here --> <body> <h1 id="top" class="headingcolors"> Welcome to my first Web Page created with HTML & CSS </h1> <p>//// During the process of making this website, I will be showing you how I learned to do simple webpage making with very easy to understand the code. This code includes languages called HyperText Markup Language (otherwise known as HTML), and a styling language called Cascading Style Sheets (otherwise known as CSS). This website was made possible by reading a book called <i>HTML&CSS; design and build websites</i> by Jon Duckett. I am a fan of Jon Duckett's book and it made me feel excited to read something that was so interesting and brought color to such a fundamental topic of learning a computer language. This website will be a work in progress with perfecting every single topic covered in HTML as well as styling my webpage and making it a professional looking website that any CEO or businessman would be interested in reading. I hope you enjoy browsing casually throughout my website and enjoying some of the topics as much as I did learning about them! ////</p> <h2 id="text" class="p">Texts</h2> <p>This is some text, hopefully i can figure out how to add color.</p> <br> <br> <br> <br> <br> <br> <h3 id="lists" class="p">Lists</h3> <p>This is some text, hopefully i can figure out how to add color.</p> <br> <br> <br> <br> <br> <br> <h4 id="links" class="p">Links</h4> <p>This is some text, hopefully i can figure out how to add color.</p> <br> <br> <br> <br> <br> <br> <h5 id="images" class="p">Images</h5> <p>This is some text, hopefully i can figure out how to add color.</p> <br> <br> <br> <br> <br> <br> <h6 id="tables" class="p">Tables</h6> <p>This is some text, hopefully i can figure out how to add color.</p> <br> <br> <br> <br> <br> <br> <h7 id="forms" class="p">Forms</h7> <p>This is some text, hopefully i can figure out how to add color.</p> <br> <br> <br> <br> <br> <br> <h8 id="extramarkup" class="p">Extra Markup</h8> <p>This is some text, hopefully i can figure out how to add color.</p> <a href="#top">Top of Webpage</a> </body> </html> 

<link type="text/css" href="Website/newWebsiteFinalCSS.css" rel="stylesheet">

是相对于html文件的。

如果html文件位于C:\\ Users \\ MyName \\ Desktop \\ Website中。

然后链接指向C:\\ users \\ MyName \\ Desktop \\ website \\ Website \\ newWebsiteFinalCSS.css

它应该是

 <link type="text/css" href="newWebsiteFinalCSS.css" rel="stylesheet">

暂无
暂无

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

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