首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Svg标签水平间隙

Svg标签水平间隙
EN

Stack Overflow用户
提问于 2014-11-11 18:12:47
回答 2查看 117关注 0票数 0

我有两个元素,我想同时显示。

http://jsfiddle.net/m7y8h7wf/

代码语言:javascript
复制
<div style="background-color:#000000;font-size:0;padding:10px;">
<svg version="1.1" width="50" height="1">
                            <g stroke="white" >
                                <line x1="50.5" y1=".5" x2=".5" y2=".5" stroke-width="1" shape-rendering="crispEdges"  />
                            </g>
                        </svg>
                        <svg version="1.1" width="50" height="1">
                            <g stroke="white" >
                                <line x1="0.5" y1=".5" x2="50.5" y2=".5" stroke-width="1" shape-rendering="crispEdges"  />
                            </g>
                        </svg>
</div>

它在firefox中看起来很不错,但在chrome中,这两个元素之间存在着明显的水平差距。

我试着去掉我能想到的所有空白/空白处,但它不想消失。

有什么想法吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-11-11 18:21:57

如果我理解了您的问题,那么在x=0中启动第二个元素,而不是x=0.5会让事情变得更紧吗?

代码语言:javascript
复制
<div style="background-color:#000000;font-size:0;padding:10px;">
  <svg version="1.1" width="50" height="1">
    <g stroke="white" >
      <line x1="50.5" y1=".5" x2=".5" y2=".5" stroke-width="1" shape-rendering="crispEdges"  />
    </g>
  </svg>
  <svg version="1.1" width="50" height="1">
    <g stroke="white" >
      <line x1="0" y1=".5" x2="50.5" y2=".5" stroke-width="1" shape-rendering="crispEdges"  />
    </g>
  </svg>
</div>

票数 2
EN

Stack Overflow用户

发布于 2014-11-11 18:31:24

让第二个svg x1值从0开始。

现在它从0.5开始,离左0.5像素。

代码语言:javascript
复制
<svg version="1.1" width="50" height="1">
    <g stroke="white">
        <line x1="0" y1=".5" x2="50.5" y2=".5" stroke-width="1" shape-rendering="crispEdges"  />
    </g>
</svg>

见更新小提琴:http://jsfiddle.net/m7y8h7wf/1/

代码语言:javascript
复制
x1 = horizontal start value of the line
x2 = horizontal end value of the line
y1 = vertical start value of the line
y2 = vertical end value of the line

您好,提摩太

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26871595

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档