【问题标题】:background position for internet explorerInternet Explorer 的背景位置
【发布时间】:2018-05-29 07:07:46
【问题描述】:

我目前有一个带有background-position: center bottom; 的背景图片,也尝试过background-position-x: center; background-position-y: bottom,但对于 Internet Explorer,它不起作用。图像贴在顶部。是否有解决方案将背景图像位置设置为适用于所有浏览器的底部?

我忘了说我使用的是 SVG 作为背景图片。

【问题讨论】:

标签: html css internet-explorer


【解决方案1】:

即使您使用 svg 作为背景图像,背景位置 css 属性在 Internet Explorer 中也能正常工作。

div {
  height: 100px;
  width: 100px;
  background-color: #ddd;
  background-position: bottom center;
  background-size: 50px 50px;
  background-repeat: no-repeat;
  background-image: url(https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/aa.svg);
}
<div></div>

【讨论】:

  • 它不能在常规的 Internet Exploter 9-11 中,而不是带有仿真的 IE Edge。我也使用 SVG 作为背景
  • 仍然可以在 IE 中使用 svg 作为背景图像 - 而不是 Edge 与仿真 - 但并非所有 svg 都是相同的,并且您尚未发布代码,因此可能存在其他问题。跨度>
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-07
  • 2013-04-04
  • 2014-11-30
  • 2012-03-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多