Click here to Skip to main content
15,880,956 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,i am creating a website. I have already created my home page and i had no problem linking my home page html page with my css style sheet but i am having a problem linking my second html page with my css style sheet. By the way i have different css style sheet for different html page. Am i missing something?


<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
  <meta charset="utf-8">
  <title>AfroChic</title>
  <link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
  <link rel="stylesheet" href="style/hair.css">
</head>
<body>
	
	<nav class="navbar">
	<span class="open-slide">
		<a href="#" onclick="openSlideMenu()">
		<svg width="30" height="30">
                <path d="M0,5 30,5" stroke="#F76C6C"
                stroke-width="5"/>
                <path d="M0,14 30,14" stroke="#F76C6C"
                stroke-width="5"/>
                <path d="M0,23 30,23" stroke="#F76C6C"
                stroke-width="5"/>
 </svg>
</a>
</span>

 <ul class="navbar-nav">
      <li><a href="index.html">Home</a></li>
      <li><a href="hair/hair.html">Hair</a></li>
      <li><a href="makeup/makeup.html">Make up</a></li>
      <li><a href="skincare/skincare.html">Skin Care</a></li>
      <li><a href="blog/blog.html">Blog</a></li>
    </ul>



  </nav>


What I have tried:

I have been looking online for a solution for more than two hours and i have tried everything that i know, i only just started coding so i don't know a lot.
Posted
Updated 8-Feb-19 0:41am
Comments
Prifti Constantine 7-Feb-19 3:28am    
Which one goes where? Where does the cdn go and where the locan css file?
Mohibur Rashid 7-Feb-19 3:34am    
is your first html and second html are in the same directory.
Member 14142347 7-Feb-19 4:45am    
No they are in different directory
Richard Deeming 7-Feb-19 16:39pm    
Did you remember to update the href in the stylesheet <link> to account for that?

HTML File Paths[^]

For example, if the HTML is in hair/hair.html and the stylesheet is in style/hair.css, then the link would be:
<link rel="stylesheet" href="../style/hair.css">

Note the ../ at the start which moves up to the parent directory.
Member 14142347 7-Feb-19 19:15pm    
Thanks for the reply, I added ../ and it worked. Thank you

1 solution

As discussed in the comments, adding a leading "../" to the path resolved the issue.
<link rel="stylesheet" href="../style/hair.css">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900