简体   繁体   English

带有背景图像的 Internet Explorer 伪元素

[英]Internet Explorer pseudo elements with background image

All versions of modern Internet Explorer (8-11) are displaying an ":after" pseudo element with a background image in it very strangely.现代 Internet Explorer (8-11) 的所有版本都非常奇怪地显示了一个带有背景图像的“:after”伪元素。 It's supposed to be a line of dots that go straight underneath the topnav, as a continuation for the "heart monitor blip".它应该是在顶部导航下方直行的一行点,作为“心脏监视器 blip”的延续。 Instead they show up like this:相反,它们显示如下:

在此处输入图片说明

Here is the site itself: http://www.makingthedifference.ca/这是网站本身: http : //www.makingthedidiffference.ca/

The background image itself is an svg, which I know is not fully supported by all IEs, but according to my tests on BrowserStack, it's being uploaded and showing up fine in IE 9, 10 and 11.背景图像本身是一个 svg,我知道并非所有 IE 都完全支持它,但根据我在 BrowserStack 上的测试,它正在上传并在 IE 9、10 和 11 中正常显示。

In the IE console on BrowserStack, the :after elements are being completely crossed out, as if IE is finding fault with them, and the dots are showing up unevenly (as pictured above).在 BrowserStack 上的 IE 控制台中, :after 元素被完全划掉,好像 IE 发现它们有问题,并且点显示不均匀(如上图)。 I do have multiple pseudo elements in there because the site is mobile responsive.我确实有多个伪元素,因为该网站是移动响应的。

Shows up fine with Chrome, Firefox and Safari.在 Chrome、Firefox 和 Safari 中显示良好。

Also, unfortunately, I can't use border-bottom dotted, the dots are not the right shape.另外,不幸的是,我不能使用 border-bottom dotted,这些点的形状不正确。

your page has 52 markup errors.....您的页面有 52 个标记错误.....

http://validator.w3.org/check?uri=http%3A//www.makingthedifference.ca/ http://validator.w3.org/check?uri=http%3A//www.makingthediifference.ca/

Line 137, Column 26: Element div not allowed as child of element ul in this context.第 137 行,第 26 列:在此上下文中,元素 div 不允许作为元素 ul 的子元素。 (Suppressing further errors from this subtree.) (抑制来自此子树的更多错误。)

.... web browsers differ in how the 'correct' coding errors..... .... Web 浏览器在“正确”编码错误的方式上有所不同.....

the HTML5 spec is the first W3 spec to specify how userAgents should correct markup and presentational (css) errors.... HTML5 规范是第一个指定 userAgents 应如何纠正标记和表示 (css) 错误的 W3 规范......

If you correct your markup errors (eg... use如果您更正标记错误(例如...使用

  • i/o for a child) ALL browsers will render your website 'More or Less' the same as there is no need for interpretation of how 'errors' should be corrected. i/o for a child)所有浏览器都会使您的网站“或多或少”相同,因为无需解释应如何纠正“错误”。

  • After much finicking, I decided to just re-save the SVG with Adobe Illustrator, and that solved the problem for all versions of IE that support SVGs.经过一番折腾,我决定用 Adob​​e Illustrator 重新保存 SVG,这解决了所有支持 SVG 的 IE 版本的问题。 I have no idea why the SVG was in error for IE, and why it worked perfectly fine for Firefox, Chrome and Safari, but it did.我不知道为什么 SVG 对 IE 出错,以及为什么它对 Firefox、Chrome 和 Safari 运行得非常好,但确实如此。

    It's about setting the width and height attributes:这是关于设置宽度和高度属性:

    <svg version="1.1" id="Laag_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 280 542" style="enable-background:new 0 0 280 542;" xml:space="preserve" width="280" height="542">
    

    As you can see the last two digits of viewBox needs to be added to width="" and height=""如您所见,需要将 viewBox 的最后两位数字添加到 width="" 和 height=""

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM