Search code examples
htmlcsscdn

link for cdn file not working with html


The HTML code given below does not follow the stylesheet that is provided in the link.
See the following code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Demo </title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
    <meta name="viewport" content="width=device-width" />

    <link href="https://raw.githubusercontent.com/nkg447/static/master/static/bootstrap3/css/bootstrap.css" rel="stylesheet" />


</head>
<body>

<div class='container'>
    <h1>nofacebook </h1>
    <h4 align="right"></h4>
    <ul class="nav nav-pills ct-blue">

              <li><a href="/">Home</a></li>

              <li><a href="/register/">Register</a></li>

              <li><a href="/login/">Login</a></li>

              <li><a href="/about/">About</a></li>

              <li><a href="/contact/">Contact</a></li>

        </ul>
</div>
</body>
</html>

The above code does not style the HTML as per the CSS link

<link href="https://raw.githubusercontent.com/nkg447/static/master/static/bootstrap3/css/bootstrap.css" rel="stylesheet" />

Solution

  • It's because GitHub really isn't meant to be used as a CDN and as such it serves the file as plain text. You can use this link instead:

    https://cdn.rawgit.com/nkg447/static/master/static/bootstrap3/css/bootstrap.css