javascript - 我画的SVG线条为什么不能贴页面顶部,而是出现在页面中间?
黄舟
黄舟 2017-04-10 17:03:52
[JavaScript讨论组]

这是我在ai画的路径,存成SVG格式得到以下的SVG path:

M0,18.348c0,0,87.111-60,183.644,37s194.534-35,194.534-35

写入HTML中后是这样的

    <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="1000" width="1000" x="20" y="20">
        <defs>
            <linearGradient id="orange_red" x1="0%" y1="0%" x2="100%" y2="0%">
                <stop offset="0%" style="stop-color:rgb(255,255,0);
stop-opacity:1" />
                <stop offset="100%" style="stop-color:rgb(255,0,0);
stop-opacity:1" />
            </linearGradient>
        </defs>
    </svg>
    <svg id="jbx" xmlns="http://www.w3.org/2000/svg" version="1.1" height="2000" width="1010" x="0" y="0">
        <g>
            <path id="1path" fill="none" d="M0,18.348c0,0,87.111-60,183.644,37s194.534-35,194.534-35" style="stroke:url(#orange_red);stroke-width:20" />
        </g>
    </svg>

得到的效果是这样的:

奇怪的是为什么不贴顶部,还莫名其妙被截去一块?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回复(2)
ringa_lee

你把第一个svg去掉就行了

大家讲道理

少年你可长点心吧……因为你设置了 stroke-width:20 啊...

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号