html - 如何在 iFrame 中包含 Bootstrap
问题描述
我目前正在做一个需要我在 iFrame 中使用 Bootstrap 的项目。我尝试将它包含在文档的头部,但它没有应用于 iFrame。我一直在尝试将 Bootstrap 链接插入 iFrame 的头部,但我无法定位它。我什至尝试将它包含两次(在包含文档和 iFrame 的头部),但它没有被应用。谁能提出一个好的方法来做到这一点?
这是我到目前为止所拥有的:index.html
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
</head>
<body>
<div class="row">
<iframe id="iframe" class="col-lg-12 col-md-12 col-sm-12">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
</head>
</iframe>
</div>
</body>
解决方案
为什么要将 CDN 添加到正文标签?这就是带有引导程序的 iframe 的完成方式。
<html>
<head>
<meta name="viewport" content="width=device-width, initialscale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="row">
<iframe id="iframe" class="col-lg-12 col-md-12 col-sm-12"></iframe>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
推荐阅读
- python - “静音”命令根本不起作用(Discord.py,重写)
- bash - 如何在 SFTP 中获取远程文件的时间戳并将其与文件本地版本的时间戳进行比较?
- python - 使用 pip 安装 Airflow
- c - 给定链表对通过更改链接进行交换
- c - nanosleep() 等待至少 15 毫秒?
- angular - 如何在一个数组中结合两个基于 ID 的 observables?
- datatable - 从 pdf 导出中的数据表标题中删除选择选项
- python - 如何将列表混合列表中的数字字符串转换为int(Python)
- java - 无法获取 getter 的值
- python - 您如何在 Flask 中发送滑块值的发布请求?