Example PreserveAspectRatio - demonstrate available options

 

< svg  width ="480px"  height ="270px"  style ="font-family:Verdana; font-size:8" >  
     
< desc > Example PreserveAspectRatio - demonstrate available options </ desc >  
     
< text  x ="10"  y ="30" > SVG to fit </ text >  
     
< transform ="translate(20,40)" >
          
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
          
< transform ="rotate(90)" >  
               
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
          
</ g >
     
</ g >  
     
< text  x ="10"  y ="110" > Viewport 1 </ text >  
     
< transform ="translate(10,120)" >
          
< rect  x =".5"  y =".5"  width ="49"  height ="29"  style ="fill:none; stroke:blue" />
     
</ g >  
     
< text  x ="10"  y ="180" > Viewport 2 </ text >  
     
< transform ="translate(20,190)" >
          
< rect  x =".5"  y =".5"  width ="29"  height ="59"  style ="fill:none; stroke:blue" />
     
</ g >  
     
< text  x ="100"  y ="30" > --------------- meet --------------- </ text >  
     
< transform ="translate(100,60)" >
          
< text  y ="-10" > xMin* </ text >
          
< rect  x =".5"  y =".5"  width ="49"  height ="29"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMinYMin meet"  viewBox ="0 0 30 40"  width ="50"  height ="30" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(170,60)" >
          
< text  y ="-10" > xMid* </ text >
          
< rect  x =".5"  y =".5"  width ="49"  height ="29"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMidYMid meet"  viewBox ="0 0 30 40"  width ="50"  height ="30" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(240,60)" >
          
< text  y ="-10" > xMax* </ text >
          
< rect  x =".5"  y =".5"  width ="49"  height ="29"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMaxYMax meet"  viewBox ="0 0 30 40"  width ="50"  height ="30" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< text  x ="330"  y ="30" > ---------- meet ---------- </ text >  
     
< transform ="translate(330,60)" >
          
< text  y ="-10" > *YMin </ text >
          
< rect  x =".5"  y =".5"  width ="29"  height ="59"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMinYMin meet"  viewBox ="0 0 30 40"  width ="30"  height ="60" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(380,60)" >
          
< text  y ="-10" > *YMid </ text >
          
< rect  x =".5"  y =".5"  width ="29"  height ="59"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMidYMid meet"  viewBox ="0 0 30 40"  width ="30"  height ="60" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(430,60)" >
          
< text  y ="-10" > *YMax </ text >
          
< rect  x =".5"  y =".5"  width ="29"  height ="59"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMaxYMax meet"  viewBox ="0 0 30 40"  width ="30"  height ="60" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< text  x ="100"  y ="160" > ---------- slice ---------- </ text >  
     
< transform ="translate(100,190)" >
          
< text  y ="-10" > xMin* </ text >
          
< rect  x =".5"  y =".5"  width ="29"  height ="59"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMinYMin slice"  viewBox ="0 0 30 40"  width ="30"  height ="60" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(150,190)" >
          
< text  y ="-10" > xMid* </ text >
          
< rect  x =".5"  y =".5"  width ="29"  height ="59"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMidYMid slice"  viewBox ="0 0 30 40"  width ="30"  height ="60" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(200,190)" >
          
< text  y ="-10" > xMax* </ text >
          
< rect  x =".5"  y =".5"  width ="29"  height ="59"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMaxYMax slice"  viewBox ="0 0 30 40"  width ="30"  height ="60" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< text  x ="270"  y ="160" > --------------- slice --------------- </ text >  
     
< transform ="translate(270,190)" >
          
< text  y ="-10" > *YMin </ text >
          
< rect  x =".5"  y =".5"  width ="49"  height ="29"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMinYMin slice"  viewBox ="0 0 30 40"  width ="50"  height ="30" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(340,190)" >
          
< text  y ="-10" > *YMid </ text >
          
< rect  x =".5"  y =".5"  width ="49"  height ="29"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMidYMid slice"  viewBox ="0 0 30 40"  width ="50"  height ="30" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
     
< transform ="translate(410,190)" >
          
< text  y ="-10" > *YMax </ text >
          
< rect  x =".5"  y =".5"  width ="49"  height ="29"  style ="fill:none; stroke:blue" />  
          
< svg  preserveAspectRatio ="xMaxYMax slice"  viewBox ="0 0 30 40"  width ="50"  height ="30" >
               
< rect  x =".5"  y =".5"  width ="29"  height ="39"  style ="fill:yellow; stroke:red" />  
               
< transform ="rotate(90)" >  
                    
< text  x ="10"  y ="10"  style ="font-family:Verdana; font-weight:bold; font-size:14" > :) </ text >  
               
</ g >
          
</ svg >
     
</ g >  
</ svg >

 

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值