html use css file path code example

Example 1: how to link css to html

<link rel="stylesheet" href="styles.css">

Example 2: add css file to html

/*
Adding css file into html document
*/

<link rel="stylesheet" type="text/css" href="yourstylesheetname.css">  /* add this line into head tag of the file with change in file name. */

/*
I hope it will help you.
Namaste
*/

Example 3: how to add a css file in html

<!DOCTYPE html>
<html>
<head>

  <link rel="stylesheet" href="styles.css">

</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Example 4: how to link an css file to html

<link rel="stylesheet" href="hi.css">

Example 5: link css with path

/*Typical link CSS code: */
<link rel="stylesheet" href="myStyles.css" type="text/css" />
/*
Absolute: 
The browser will always interpret / as the root of the hostname. 
For example, if my site was http://google.com/ and I specified /css/images.css 
then it would search for that at http://google.com/css/images.css. 
If your project root was actually at /myproject/ it would not find the css file.
Therefore, you need to determine where your project folder root is relative 
to the hostname, and specify that in your href notation.

Relative:
If you want to reference something you know is in the same path on the 
url - that is, if it is in the same folder, 
for example http://mysite.com/myUrlPath/index.html and 
http://mysite.com/myUrlPath/css/style.css, and you know that it will always 
be this way, you can go against convention and specify a relative path 
by not putting a leading / in front of your path, for example, css/style.css.

Filesystem Notations: 
Additionally, you can use standard filesystem notations 
like ... If you do http://google.com/images/../images/../images/myImage.png 
it would be the same as http://google.com/images/myImage.png. If you want 
to reference something that is one directory up from your file, 
use ../myFile.css.
*/

Tags:

Css Example