简体   繁体   中英

i wanted to link the html and css files. but does not work

<html>

<head>

<title> HELLO </title>

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

</head>

<body>

<h1> WELCOME TO THE NEW WORLD </h1>

<p>  This is the world of Oppurtunities </p>

</body>

</html>

the css file is below.

body{
    background-color: darkslategrey;
    color: azure;
     }

h1{
    color: coral;
     }

You question is pretty vague but your path to the CSS is probably off.

Without more info on your dev environment this is my best suggestion.

Change your CSS link to...

<link rel="stylesheet" type="text/css" href="../back.css"/> Notice the ./back.css

This may not be the correct path to the file but your issue lies in your relative path . It all depends on your file structure.

Basic Examples

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

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

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

Perhaps putting the css file into a folder might work out.

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

That usually does the trick, let us know ;)!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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