html - HTML:iframe 和段落在同一行
问题描述
我想在我的 HTML 页面的 div 中的同一行上有一个 iframe 和一个段落。这应该会创建页面的预览和旁边的描述。
<div class="element">
<div class="preview">
<iframe width="640px" height="360px" src="http://example.com" style="-webkit-transform:scale(0.5);-moz-transform-scale(0.5);"></iframe>
</div>
<div class="description">
<h4>Header</h4>
<p>Paragraph</p>
</div>
</div>
解决方案
您可以为此使用 flexbox:
.element {
display: flex;
flex-wrap: nowrap;
}
<div class="element">
<div class="preview">
<iframe width="640px" height="360px" src="http://example.com"></iframe>
</div>
<div class="description">
<h4>Header</h4>
<p>Paragraph</p>
</div>
</div>
或者这样:
<div class="element" style="display:flex; flex-wrap:nowrap">
<div class="preview">
<iframe width="640px" height="360px" src="http://example.com"></iframe>
</div>
<div class="description">
<h4>Header</h4>
<p>Paragraph</p>
</div>
</div>
推荐阅读
- firebase - GunDB 存储和超级对等选项
- swift - 如何制作一个从地址swift 4返回坐标的函数
- django - 我可以访问 django @register.assignment_tag 中的请求对象吗
- c# - 检查 List 的元素是否等于输入
- c# - 在没有易失性机制的情况下,CPU 何时写入主存?
- algorithm - 在螺旋中找到特定元素坐标的算法
- javascript - 如何在 Angular 中实现磁性滚动?
- reactjs - 样式化组件的 Nth-child 不起作用
- github - Travis CI - 401 - 构建失败 - 私人回购上的错误凭证
- r - 因子 `country` 包含隐式 NA,考虑使用 `forcats::fct_explicit_na`