gpt4 book ai didi

mozilla firefox 和 internet explorer 中的 CSS 不同输出

转载 作者:行者123 更新时间:2023-11-28 00:42:40 25 4
gpt4 key购买 nike

我正在练习 css,我遇到了这个问题。我正在使用 svg 作为背景。当我尝试在 Opera 和 Google Chrome 中运行它时,我得到了我想要的结果,如下所示: enter image description here

但是当我尝试在 mozilla 中运行它时,它看起来像这样,顶部和底部有几个空格: enter image description here

而且,在 Internet Explorer 中,svg 显得格格不入,如下所示: enter image description here

我试过使用 css reset,但没有任何反应。

这是我的svg代码

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 22.58">
<defs><style>.cls-1{fill:url(#linear-gradient);}</style><linearGradient id="linear-gradient" x1="15.6" y1="9.41" x2="10.68" y2="22.94" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#65ffb7"/><stop offset="1" stop-color="#47f2d0"/></linearGradient></defs>
<title>landing bg</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1">
<polygon class="cls-1" points="10.54 0 0 16.03 9.31 22.58 24 22.58 24 0 10.54 0"/></g></g></svg>

CSS 代码

body
{
background-color: white;

}

.frame1
{
background: #000000 url('../images/landing_bg.svg');
background-repeat: no-repeat;
background-position: right;
height: 900px;
width: 100%;
position: absolute;
min-width: 900px;
top: 0;
right: 0;
}

HTML代码

<!DOCTYPE html>
<html>
<head>

<link rel = "stylesheet" type = "text/css" href = "main page/main.css">
<link rel = "stylesheet" type = "text/css" href = "main page/reset.css">
</head>

<body>
<div class = "frame1">

</div>
</body>

我是否遗漏了什么或者是否应该删除某些东西以获得我想要的结果(见第一张图片)?

最佳答案

问题似乎出在您的 svg viewbox 上。

尝试例如

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">

老实说,我无法提供任何信息来解释这种行为。但我找到了这个 topic ,可能跟这个原因有关。

关于mozilla firefox 和 internet explorer 中的 CSS 不同输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52543041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com