Html 离线引导
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44173113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Offline bootstrap
提问by user1872384
How can I make this work in offline? This is in my index.html:
我怎样才能离线工作?这是在我的 index.html 中:
<link href='https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/paper/bootstrap.min.css' rel='stylesheet'>
Update:
更新:
There's a line in the css that contains http call to get the font css, do I need to download it offline as well?
css中有一行包含http调用来获取字体css,我是否也需要离线下载?
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500,700");/*!
回答by gavgrif
Download the minified CSS file from Bootstrap and store it in an external CSS folder - then call it into the page as an external CSS resource
从 Bootstrap 下载缩小的 CSS 文件并将其存储在外部 CSS 文件夹中 - 然后将其作为外部 CSS 资源调用到页面中
for example:
<link rel="stylesheet" href="css/bootstrap.min.css">
回答by Ehsan
Download Boostrap file and Save it.
下载 Boostrap 文件并保存。
basic syntax :
基本语法:
<link href='Path/yourNameFile.css' rel='stylesheet'>
Path is interpreted relative to the source of the Html file.
For Example : if Your bootstrap file is in Folder MyBootstrap and so This Folder and Html file are some Place,Your code must be like this :
路径相对于 Html 文件的源进行解释。
例如:如果你的引导文件在文件夹 MyBootstrap 中,所以这个文件夹和 Html 文件在某个地方,你的代码必须是这样的:
<link href='MyBootstrap/YourNameFile.css' rel='stylesheet'>
回答by Carlos Galan
you have to download the css files and then use somethin like this
你必须下载css文件,然后使用这样的东西
<link href="css/bootstrap.min.css" rel="stylesheet">
you can see more here: https://getbootstrap.com/getting-started/
你可以在这里看到更多:https: //getbootstrap.com/getting-started/
回答by Vishal Vetrivel
Go to http://getbootstrap.com/and download bootstrap put it in the same folder as your html and call it like this.
转到http://getbootstrap.com/并下载 bootstrap 将其放在与您的 html 相同的文件夹中,并像这样调用它。
<link rel="stylesheet" href="css/bootstrap.css"/>
回答by Er Amit Anand
The best way to download usable bootstrap js and css files on your local folder and use it, after that automatically increase your page speed.
在本地文件夹中下载可用的 bootstrap js 和 css 文件并使用它的最佳方法,之后会自动提高页面速度。
回答by Shailesh Bhat
If you want to use bootstrap files below in offline then just download these file on you PC.
如果您想离线使用下面的引导程序文件,那么只需在您的 PC 上下载这些文件。
- Then remove text from https till just before the main file
- Remove integrity & crossorigin attribute contents
- Wolla! now you can see bootstrap files without CDN links.
- The reference links & sheets wont work till you Remove integrity & crossorigin attribute contents.
- 然后从 https 中删除文本直到主文件之前
- 删除完整性和跨域属性内容
- 哇!现在您可以看到没有 CDN 链接的引导文件。
- 除非您删除完整性和跨域属性内容,否则参考链接和工作表将无法使用。
Go ahead with this tip & tell me if it worked for you. i.e
继续这个技巧并告诉我它是否对你有用。IE
<link rel="stylesheet" href="bootstrap.min.css" >
<link rel="stylesheet" href="bootstrap.min.css" >
<script src="jquery-3.4.1.slim.min.js" ></script>
<script src="popper.min.js"></script>
<script src="bootstrap.min.js" ></script>
Place the bootstarp files in the same folder with html files as you are giving the relative path. If you have saved bootstrap files in a folder the give src="foldername/filename"
path.
将 bootstarp 文件与 html 文件放在同一文件夹中,因为您提供了相对路径。如果您已将引导程序文件保存在文件夹中,请提供src="foldername/filename"
路径。
回答by nikhil sugandh
In addition to gavgrif's
answer you will also need the file at this:
除了gavgrif's
回答你还需要这个文件:
https://code.jquery.com/jquery-3.4.1.min.js
and this command to be pasted in section:
并将此命令粘贴到部分中:
<script src="jquery-3.4.1.min.js"></script>