How to include files or link?

What is the best way to include bootstrap in html in files or link?

  • link href="css/bootstrap.css" rel="stylesheet" media="screen" link href="css/bootstrap.min.css" rel="stylesheet" media="screen" or

  • link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"

  • or both ?


    Using a CDN link (second option) for including libraries is generally considered a better approach since there are chances that many users would already have these files cached in their browsers resulting in faster page loads, you save bandwidth as these files are not hosted on your server and leverage lower response times from CDN servers.

    I assume that you'll keep your custom styles(if any) in a separate file which anyways has to be stored on your server and loaded from there.

    Whereas in the first option, the browser has to download the files when a user visits your site for the first time resulting in a slight overhead.


    It depends on how popular the file that you want to include

    If it's more popular (by popular I mean most of the people on the web are using the same css and js files) like in your case (bootstrap.min.css), use CDN URL. The reason for that lots of sites might be using same CDN URL and probably get it from there, so you have a decent chance of that file already being cached when a user gets to your site.

    链接地址: http://www.djcxy.com/p/75986.html

    上一篇: 这是可能的p标签没有使用跨度或任何新的HTML标签?

    下一篇: 如何包含文件或链接?