html - 设置一个
的背景图像,跨浏览器问题?
问题描述
hr
使用元素插入图像(使用background-image
)会有什么问题吗?
我正在寻找一个不错的语义选项来插入用作页面分隔符的英雄图像。我不想使用section
,因为它真的没有分段内容。因为它在技术上是内容的标题英雄,所以我可以将它添加到它section
下面的顶部……但hr
感觉是对的。
一位同事提到他们认为hr
只会border-bottom
在“某些”(未引用)浏览器中呈现它并忽略所有其他 CSS 属性,但我在任何地方都没有看到记录。
语义/技术思想?你用过hr
这种方式吗?
编辑
这是我使用它的方式:
<style>
.hero_separator {
display: block;
border: none;
height: 428px;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
</style>
<hr class="hero_separator" style="background-image: url(<?= $background ?>);"/>
解决方案
推荐阅读
- javascript - 幻灯片的多个实例中断代码
- javascript - 每个验证选项的 Joi 自定义错误
- javascript - 将 Azure Bot 对话存储到 Blobstorage for javascript
- nativescript-angular - 如何在 nativescript angular 中为默认启动画面设置动画
- google-apps-script - 取消按钮 UI 提示
- flutter - 从材料指南中实现“移动步骤进度条”
- web-scraping - 出现 403 错误|“需要注意!” 尝试抓取时的验证码
- javascript - 传播语法返回意外对象
- erlang - 如何从 mnesia 中仅选择 X 条记录
- docker - docker下ubuntu18.04的binfmt_misc问题