簡體   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