简体   繁体   English

如何限制pygal中svg的宽度/高度

[英]How to limit the width/height of svg in pygal

How do I limit the width/height of a pygal generated SVG? 如何限制pygal生成的SVG的宽度/高度? I'm currently doing it via img tags, but is there a better way? 我目前正在通过img标签来做,但是有更好的方法吗?

<img src="http://localhost/images/Store.Diapers.svg" width=800 height=600/>

如果它对某人有帮助,就像在参数中指定width = 1000,height = 800一样简单:

chart = pygal.StackedLine(width=1000, height=800)

You can use a div for that.... 你可以使用div ...

Place the following in your code: 将以下内容放入您的代码中:

<div class="parent">    
   <img src="http://localhost/images/Store.Diapers.svg">    
</div>    

And place this in your .css file 并将其放在.css文件中

.imagebox {
width: 42px; /*This is the height of the div class it self */
height: 42px;
}

/* This changes the height of any image with the <img> tag within the div class*/
.imagebox img {
height: 800px;
width: 600px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM