提问者:小点点

SVG在IE11中中断到下一行


我的问题是,尽管我在SVG中添加了“display:inline”,但是IE11中带有文本的a-tag中的SVG仍然会进入下一行。

在a-tag上添加“display:flex”也不能正常工作--只是奇怪地破坏了文本

HTML:



   
.m-stage-content {
    max-width: 420px;
    position: absolute;
    bottom: 2rem;
    -webkit-box-shadow: 0 4px 6px rgb(0 0 0 / 15%);
    box-shadow: 0 4px 6px rgb(0 0 0 / 15%);
}

.m-stage-txt {
    border-radius: 4px;
    padding: 1.5rem;
}

.m-stage .-whitebg {
    background: rgba(255,255,255,.9);
}

.c-btn-primary {
    background: #238900;
    text-align: center;
    font-size: .9999rem;
    font-weight: 300;
    padding: .625rem .75rem;
    line-height: 20px;
    border: 1px solid #238900;
    border-radius: 4px;
    color: #fff;
}

.m-stage-btn {
    display: inline-block;
}

.m-stage-btn svg {
    height: 12px;
    vertical-align: baseline;
    margin: 0 0 0 .5rem;
}

.c-btn-primary-icon {
    fill: #fff;
}
<div class="m-stage-content -left">
   <div class="m-stage-txt -whitebg">
      <h1 class="m-stage-headline">Headline</h1>
      <span class="m-stage-description"><h3 style="margin: 0px; padding: 0px; border: 0px currentColor; border-image: none; line-height: 34px; vertical-align: baseline; font-stretch: inherit; font-variant-numeric: inherit; font-variant-east-asian: inherit;">Subline<br></h3></span>
      <a class="m-stage-btn c-btn-primary" href="/more">
            More information
            <svg xmlns="http://www.w3.org/2000/svg" class="c-btn-primary-icon" fill="none" viewBox="0 0 8 16">
               <path d="M 0.547594 1.13915 L 0.326625 1.36009 C 0.180188 1.50652 0.180188 1.74396 0.326625 1.89043 L 6.43578 7.99962 L 0.326625 14.1088 C 0.180188 14.2552 0.180188 14.4927 0.326625 14.6391 L 0.547594 14.8601 C 0.694031 15.0065 0.931469 15.0065 1.07791 14.8601 L 7.67325 8.26477 C 7.81969 8.11834 7.81969 7.8809 7.67325 7.73443 L 1.07791 1.13915 C 0.931469 0.99268 0.694031 0.99268 0.547594 1.13915 Z" />
            </svg>
      </a>
   </div>
</div> 

共1个答案

匿名用户

您是否尝试将高度和宽度添加到您的xml中,即需要这样做,否则它会将其作为全宽处理。那么它应该是这样的:

        <svg xmlns="http://www.w3.org/2000/svg" height="80" width="80"  class="c-btn-primary-icon" fill="none" viewBox="0 0 8 16">
           <path d="M 0.547594 1.13915 L 0.326625 1.36009 C 0.180188 1.50652 0.180188 1.74396 0.326625 1.89043 L 6.43578 7.99962 L 0.326625 14.1088 C 0.180188 14.2552 0.180188 14.4927 0.326625 14.6391 L 0.547594 14.8601 C 0.694031 15.0065 0.931469 15.0065 1.07791 14.8601 L 7.67325 8.26477 C 7.81969 8.11834 7.81969 7.8809 7.67325 7.73443 L 1.07791 1.13915 C 0.931469 0.99268 0.694031 0.99268 0.547594 1.13915 Z" />
        </svg>