0

I'm new in HTML and I'm trying to use bootstrap in my project.

The problem is that I can't load bootstrap.min.css and none of the classes work. I did some searching and tried some ways but they didn't work for me

Here is my code :

<!DOCTYPE html>
%{--<!doctype html>--}%
<html>
 <head>
  <meta charset = "utf-8">
  <meta http-equiv = "X-UA-Compatible" content = "IE = edge">
  <meta name = "viewport" content = "width = device-width, initial-scale = 1">
  %{--<link href="bootstrap.min.css" rel="stylesheet" media="screen">--}%
  
   <link rel="stylesheet" href="E:\TekDays\web-app\bootstrap-3.3.7-dist\css\bootstrap.min.css" type="text/css">
 <title>TekDays - The Community is the Conference!</title>

 </head>
  <body>
   <div class="container">
 <table class="table table-bordered">
  <thead>
   <tr>
    <th>FirstName</th>
    <th>FirstName</th>
   </tr>
  </thead>
     <tr>
   <td>Mammad</td>
   <td>mammadii</td>
  </tr>
  <tr>
   <td>Akbar</td>
       <td>Akbarii</td>
  </tr>
 </table>
  </div>
 </body>
</html>
  1. Using absolute path results in an error(use f12): Not allowed to load local resource: file:///E:/TekDays/web-app/bootstrap-3.3.7-dist/css/bootstrap.min.css

I read somewhere that it's only chrome's error and Edge or IE browsers don't have this problem, they don't but the results are the same, css classes are not applied.

  1. I put the bootstrap.min.css under the same directory as my html page is and used <link href="bootstrap.min.css" rel="stylesheet" type="text/css" media="screen"> instead of what is used in the code.

but this time I got error 404: not found This seems to be my problem with the path I've given...but I don't know what to do

Any idea what's wrong with it?

Navid
  • 157
  • 2
  • 2
  • 14

4 Answers4

0

The slash used here

<link rel="stylesheet" href="E:\TekDays\web-app\bootstrap-3.3.7-dist\css\bootstrap.min.css" type="text/css">

would cause user browser to access the file from his filesystem.

Change the path

<link rel="stylesheet" href="E:/TekDays/web-app/bootstrap-3.3.7-dist/css/bootstrap.min.css" type="text/css">

UPDATED ANSWER : Resource not found Error and what about resources plugin

Community
  • 1
  • 1
Shahil M
  • 3,836
  • 4
  • 25
  • 44
  • Error Not allowed to load local resource: file:///E:/TekDays/web-app/bootstrap-3.3.7-dist/css/bootstrap.min.css – Navid Aug 23 '16 at 06:52
-1
<!DOCTYPE html>
<html>
 <head>
  <meta charset = "utf-8">
  <meta http-equiv = "X-UA-Compatible" content = "IE = edge">
  <meta name = "viewport" content = "width = device-width, initial-scale = 1">
  <link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css">
  <title>TekDays - The Community is the Conference!</title>

 </head>
  <body>
   <div class="container">
    <table class="table table-bordered">
     <thead>
      <tr>
       <th>FirstName</th>
       <th>FirstName</th>
      </tr>
     </thead>
     <tr>
      <td>Mammad</td>
      <td>mammadii</td>
     </tr>
     <tr>
      <td>Akbar</td>
       <td>Akbarii</td>
     </tr>
    </table>
  </div>
 </body>
Omar
  • 527
  • 5
  • 21
  • It workes but im intrested to load it from local sources But thanks for your help – Navid Aug 23 '16 at 06:49
  • open given link in your browser & save it from your browser to your folder where are your index.html file & call it like: – Omar Aug 23 '16 at 07:02
-1

its work check your css path

<!DOCTYPE html>

<html>
 <head>
  <meta charset = "utf-8">
  <meta http-equiv = "X-UA-Compatible" content = "IE = edge">
  <meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" media="screen">
  
 
 <title>TekDays - The Community is the Conference!</title>

 </head>
  <body>
   <div class="container">
 <table class="table table-bordered">
  <thead>
   <tr>
    <th>FirstName</th>
    <th>FirstName</th>
   </tr>
  </thead>
     <tr>
   <td>Mammad</td>
   <td>mammadii</td>
  </tr>
  <tr>
   <td>Akbar</td>
       <td>Akbarii</td>
  </tr>
 </table>
  </div>
 </body>
User
  • 1,334
  • 5
  • 29
  • 61
  • I think the OP is asking why his code is not working – Mark Perera Aug 23 '16 at 06:33
  • It workes thanks But do you know what was my problem with paths? – Navid Aug 23 '16 at 06:41
  • Try adding an additional slash in path this '\' may have problem use like E://TekDays//web-app//bootstrap-3.3.7-dist//css//bootstrap.min.css – User Aug 23 '16 at 06:42
  • Again the same error : Not allowed to load local resource: file:///E://TekDays//web-app//bootstrap-3.3.7-dist//css//bootstrap.min.css – Navid Aug 23 '16 at 06:46
-1

href replace with src

<link href="bootstrap.min.css" rel="stylesheet" type="text/css" media="screen">

<link *src*="bootstrap.min.css" rel="stylesheet" type="text/css" media="screen">
Imam
  • 41
  • 6