dqqg0811 2014-11-22 00:35
浏览 184
已采纳

具有不同大小的SVG上的CSS效果(阴影,笔画)

i have a problem with SVGs (different sizes) and effetcs (strokes, shadows etc.) The stroke (for example) has not the same size because the icon B is smaller and it is "zoomed" to 500px.

What is the correct way to fix this issue?

  • must i calculate the effect for every SVG individually? :/
  • or is there an option to only zoom the SVG and not the effect?
  • or can i recalculate (with PHP) the SVGs? So that every SVG has the same size?

FIDDLE
http://jsfiddle.net/tqef7qkp/

CSS

stroke: #39A02E;  
stroke-width: 5;

Example example


A)
<svg xml:space="preserve" 
preserveAspectRatio= "xMinYMin meet" 
enable-background="new 0 0 500 500" 
viewBox="0 0 500 500" 
width="500px" 
height="500px" 
y="0px" 
x="0px" 
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg" version="1.1">


B)
<svg xml:space="preserve"
preserveAspectRatio= "xMinYMin meet" 
enable-background="new 0 0 50 50" 
viewBox="0 0 50 50" 
width="500px" 
height="500px" 
y="0px" 
x="0px" 
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg" version="1.1">
  • 写回答

2条回答 默认 最新

  • doudichu1358 2014-11-22 04:06
    关注

    You can specify stroke-widths in percentages, not just userSpace units. You can also specify shadow filters the same way (in objectBoundingBox units). This will size your strokes to the size of your svg's vs. the size of your viewboxes.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题