[英]SVG display block causes gap between elements in IE 11
I Know that internet explorer doesn't play nice with SVGs. 我知道Internet Explorer无法与SVG配合使用。 I notice that when changing display: block
to display: flex
does decreases the size of the gap. 我注意到在将display: block
更改为display: flex
确实会减小间隙的大小。 however it doesn't remove it. 但是它不会将其删除。
I am declaring height
and width
in the styles but the issue seems to persist in IE 11 我在样式中声明了height
和width
,但是该问题似乎在IE 11中仍然存在
// Declarations
.o-navigation {
align-items: center;
display: flex;
@include font-smooth;
padding: (.5 * $spacing-base) $spacing-base;
.logo-access {
.icon-logo-full {
width: 135px;
height: 23px;
display: block;
@media screen and (min-width: $screen-desktop) {
.home & {
width: 270px;
height: 45px;
}
}
}
}
}
https://github.com/CityOfNewYork/ACCESS-NYC-PATTERNS/blob/master/src/objects/navigation/_navigation.scss https://github.com/CityOfNewYork/ACCESS-NYC-PATTERNS/blob/master/src/objects/navigation/_navigation.scss
Where might the issue come from? 问题可能从何而来?
After using F12 developer tools to check the CSS style, I think the problem is caused by the different rendering way in IE11 that leads to the "o-navigation color-dark-background" having different heights in IE11 and other browsers. 在使用F12开发人员工具检查CSS样式之后,我认为问题是由IE11中的不同渲染方式引起的,导致IE11和其他浏览器中的“ o-导航颜色-深色背景”具有不同的高度。 You can give the "o-navigation color-dark-background" a specific height value familiar with the value in other browsers. 您可以为“ o-导航颜色为深色背景”指定一个特定的高度值,该高度值应与其他浏览器中的值相似。 Here I try to set the height value to 52px and then the gap disappears. 在这里,我尝试将高度值设置为52px,然后间隙消失。 Like this: 像这样:
IE doesn't play well with SVGs. IE不能很好地与SVG配合使用。 The other answer to this post regarding adding the height style to the page does seem to work, and many other post regarding this issue direct to that solution. 这篇关于在页面上添加高度样式的文章的其他答案似乎确实可行,而关于此问题的许多其他文章也直接针对该解决方案。 What did it for me was adding overflow: hidden
to the links in the nav. 对我来说,这是在增加overflow: hidden
在导航中的链接。
.nav-inline {
@include typography-nav();
list-style: none;
text-align: $text-direction-end;
flex: 1 1 auto;
margin: 0;
padding: 0;
a {
display: inline-block;
margin-#{$text-direction-start}: 1em;
overflow: hidden;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.