英文:
Why do I get very different results for SVG path i.e. vs chrome?
问题
以下是翻译好的内容:
"Hi I have this SVG path and it works perfectly in IE (oddly) but only displays a tiny line in Chrome. Any help appreciated!"
style:
.svg {
z-index: 1;
position: absolute;
top: 0px;
left: 0px;
}
英文:
Hi I have this SVG path and it works perfectly in IE (oddly) but only displays a tiny line in Chrome. Any help appreciated!
<svg class="svgs" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path style="stroke:#ff0000; fill:none;" d="M428 237L200 500"/></svg>
style:
.svg {
z-index: 1;
position: absolute;
top: 0px;
left: 0px;
}
答案1
得分: 2
您没有指定高度、宽度(或视图框)。
默认画布大小为300 x 150像素,您大部分时间在画布外绘制。
看起来Chrome(和Firefox)默认为overflow: hidden; 而IE默认为overflow: visible。
最好指定一个大小并将您的绘制限制在该大小内。
英文:
You've not specified a height or width (or a viewBox).
The default canvas size is 300 x 150px and you're mostly drawing outside of that.
Looks like Chrome (and Firefox) default to overflow: hidden; whereas IE defaults to overflow: visible
Best specify a size and restrict your drawing to that size.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论