reactjs svg或剪切路径不适用于ie / edge

时间:2020-10-31 22:11:03

标签: reactjs svg

因此我注意到ie / edge不支持clip-path。我读过一种解决方案,如果您将其转换为在jsx中使用svg,它将可以使用。但是,这似乎也不起作用。

app.js中的jsx代码

import React from "react";
import "./styles.css";

export default function App() {
  return (
    <div className="app">
      <svg width="0" height="0">
        <clipPath id="myclippath" clipPathUnits="objectBoundingBox">
          <polygon points="0.50 0.50, 1.00 0, 1.00 1.00, 0 1.00, 0 0" />
        </clipPath>
      </svg>
      <div className="div-intro-bottom" />
    </div>
  );
}

css

/*--------------------------- Reset ---------------------------*/
html, body, div, span, applet, 
object, iframe, blockquote, pre,
abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

h1 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 3.2rem;
  vertical-align: baseline;
}

h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 2.4rem;
  vertical-align: baseline;
}

h3 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.872rem;
  vertical-align: baseline;
}

h4, p, a {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.6rem;
  vertical-align: baseline;
}

a:link {
  color: (internal value);
}
a:visited {
  color: (internal value);
}
a:link:active {
  color: (internal value);
}
a:visited:active {
  color: (internal value);
}

h5 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.328rem;
  vertical-align: baseline;
}

h6 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.072rem;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
  display: block;
}

body {
  line-height: 1;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

html,
body,
#root {
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Roboto, Arial, sans-serif;
  height: 100%;
  font-size: 62.5%;
  min-height: 100%;
}

*, *::before, *::after {
  box-sizing: inherit;
  -webkit-box-sizing: inherit;
}

img {
  width: 100%;
}
/*-------------------------- Desktop --------------------------*/
.div-intro-bottom {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  clip-path: url(#myclippath);
  /* clip-path: polygon(50% 50%, 100% 0, 100% 100%, 0 100%, 0 0); */
}

https://tukrk.csb.app/ <-适用于chrome / firefox,但不适用于ie / edge。我想念什么?

边缘信息:

  • Microsoft Edge 44.18362.449.0
  • Microsoft EdgeHTML 18.18363

IE信息: 版本11

沙箱中的代码-https://codesandbox.io/s/clip-path-with-ieedge-support-tukrk?file=/src/App.js

我正在尝试与此处提供的解决方案相同,但是没有运气:Easiest way to convert polygon clip-path to Microsoft Edge supported "clippath" svg?

0 个答案:

没有答案