Reputation: 121
I am trying to link an external CSS file with a HTML page but it does not work.
<html>
<head>
<link rel="stylesheet" href="D:\bootstrap\cssbootstrap.min.css">
</head>
<body>
<input type="button" class="btn btn-primary" value=Submit>
</body>
</html>
Help me to solve this problem.
Upvotes: 0
Views: 1869
Reputation: 316
locate your css files in the folder in which your html file s located. Then Try Like The following,
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
Upvotes: 0
Reputation: 5875
Do not specify a Windows-style path in href
attributes.
You can use the file URI scheme to specify paths to local files:
<link rel="stylesheet" href="file:///D:/bootstrap/cssbootstrap.min.css">
Also, you can always use directory traversal with dots and slahes:
.
this location..
up a directory../
the parent of the current directory./
the current directory/
the root of the currentSo if there’s a Bootstrap folder in your WWW root, this will work:
<link rel="stylesheet" href="/bootstrap/cssbootstrap.min.css">
Finally, according to the W3C spec, the href
attribute…
( … ) must contain a valid non-empty URL potentially surrounded by spaces
If you are really interested in all the possible ways, see the W3C spec on valid URLs.
Upvotes: 2
Reputation: 42
You've got most of it right, but I don't think you picked the right path to the your css folder. Enter the folder your html is in, then go and add the Css file to the same folder.
<link rel="stylesheet" href="cssbootstrap.min.css">
Change your link tag into that and it should work.
If you're still having problems try giving this page a go http://www.w3schools.com/css/css_howto.asp
Upvotes: 0