2016-12-16 66 views
0

所以我想讓我的HTML文件的背景顯示爲漸變。例如,像這樣:http://uigradients.com/#但是,我的樣式表沒有鏈接到我的HTML文件,所以不僅我的字體不能正常工作,而且我的漸變也不是。爲什麼我的樣式表沒有鏈接到我的HTML文件?

所以基本上,這是我的索引文件看起來像之前我搞砸了:http://crwirth.github.io和基本上我想要做的是讓背景漸變。

這裏是我的HTML文件:

<link href='https://fonts.googleapis.com/css?family=Lobster'  rel='stylesheet' type='text/css'> 
<!-- CSS 
–––––––––––––––––––––––––––––––––––––––––––––––––– --> 
<link rel="stylesheet" type="text/css" href="index.css" media="screen"> 

</head> 
<!--–––––––––––––––––––––––––––––––––––––––––––––––––– --> 
<body> 
    <div class="element"> 
      <h1><a id="line1" class="categories" title="shortblurb1" font-family="'Lobster', cursive" font-weight="normal" text-align="left" ;>Welcome, I hope you enjoy everything you encounter here:</a></h1> 
      <h2><a id="line2" class="categories" href="https://github.com/crwirth" title="shortblurb2" font-family="'Lobster', cursive" font-weight="normal" text-align="left" ;>My GitHub</a></h2> 
      <h2><a id="line2" class="categories" href="https://wirthrcody.wordpress.com/" title="shortblurb2" font-family="'Lobster', cursive" font-weight="normal" text-align="left" ;>My Blog</a></h2> 
      <h4><a id="line5" class="categories" href="https://twitter.com/codyrwirth" title="shortblurb5" font-family="'Lobster', cursive" font-weight="normal" text-align="left" ;>Follow me on Twitter</a></h4> 
      <h5><a id="line6" class="categories" href="https://www.linkedin.com/in/wirthcodyr"title="shortblurb6" font-family="'Lobster', cursive" font-weight="normal" text-align="left" ;>Connect with me on LinkedIn</a></5> 
        <style> 
        </style> 
      </div> 
</body> 
</html> 

好吧,這裏是我的CSS文件:

background: #ee0979; /* fallback for old browsers */ 
background: -webkit-linear-gradient(to left, #ee0979 , #ff6a00); /* Chrome 10-25, Safari 5.1-6 */ 
background: linear-gradient(to left, #ee0979 , #ff6a00); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ 


html { 
    background-color: #ee0979; 
} 

a { 
    color: black; 
    text-decoration: none; 
    font-family: "Lobster", cursive; 
    text-align: left; 
} 

h1 { 
    color: black; 
    font-family: "Lobster", cursive; 
    font-size: 1.9em; 
    text-align: left; 
    margin-left: 15px; 
    margin-top: 20px; 
    padding-left: 60px; 
    padding-top: 10px; 
    padding-bottom: 25px; 
    } 

a:hover { 
    text-decoration: underline; 
} 


a { 
     color: black; 
     font-family: "Lobster", cursive; 
     font-size: 3.1em; 
     text-align: left; 
     padding-left: 40px; 
     padding-top: 15px; 
     padding-bottom: 15px; 
} 
+0

它在同一個目錄下嗎? – ImAtWar

+0

請檢查(也許甚至發佈)您的目錄結構@ImAtWar說。此外,避免使用內聯(即在您的HTML)樣式。它使代碼不可讀,高度複製,並且很難在將來修改。 – Jack

回答

0

在這裏的代碼在你的問題是好的,但在您的網站存在對css文件的不良引用

enter image description here

+0

好抓@JulioSilva。我建議將href更新爲'https:// crwirth.github.io/stylesheets/stylesheet.css'。我查了一下,文件在那裏。 – 2016-12-16 19:55:28

+0

是的,它真的很奇怪,所以唯一能讓它工作的方式是在HTML文檔中使用內聯樣式,否則我的CSS工作表拒絕鏈接到我的HTML文檔。而真正奇怪的是,我注意到它最終確實喜歡我的HTML文檔時,它將完全無效字體和漸變背景。 –

相關問題