html - 使用 CSS 循环裁剪 iframe
问题描述
我已经使用边框半径将方形 iframe 切割为圆形(使用具有边框半径:50% 的 earth2 类),但它仍然在地球周围保留黑色边框。我想裁剪以仅显示地球。我的代码在下面,我还可以进行哪些更改来裁剪黑色背景?
我当前的预览在这里:
我的代码是:
<style>
.main_content {
width: auto;
height: auto;
position: relative;
}
.earth2{
border-radius:50%;
border-width:267px;
}
.earth {
width:400px;
height:400px;
border-radius:50%;
left: 50%;
top:50%;
margin-left: -200px;
margin-top: -200px;
padding: 0px;
background-color: red;
position: absolute;
opacity:0.8;
}
</style>
<div class="main_content">
<div class="graph" id="canvas-holder" style="width:100%">
<canvas id="chart-area" width="500" height="500"></canvas>
</div>
<div class="earth">
<iframe class="earth2" src="https://solarsystem.nasa.gov/gltf_embed/2393" width="400px" height="400px" frameborder="0" >
</iframe>
</div>
</div>
解决方案
您可以应用边框 0px 以使边框消失到 div“地球”
推荐阅读
- javascript - 在调用 jquery form.submit 时,需要澄清按钮类型的输入与提交类型的输入之间的区别
- c++ - 静态演员表中的表达式
- r - ggplots 的 ggarrange() 重叠 annotate() 文本
- amazon-web-services - 对 AWS 上不显示的负载均衡器选项卡进行故障排除
- c# - 如何在可执行文件的不同文件夹中有 .NET 引用
- python - 基于其他列长度的列中值的索引列表
- reactjs - 材质 UI 日期范围选择器
- node.js - 如何执行 NPM 的全新安装
- c++ - 我想在字母而不是数字中使用(排序插入),但我不明白如何
- laravel - 将 laravel 响应返回为 csv 而不是 json