[英]How can I make parent <button> take size of child <svg>
I use svg image with help of use
from previously created sprite.我使用SVG图像以帮助
use
以前创建的精灵。 The problem is that when I have <svg>
inside of button
then div takes the whole space available when expected income is to be the same size as child.问题是,当我在
button
内有<svg>
时,当预期收入与孩子的大小相同时,div 会占用整个可用空间。 Any help?有什么帮助吗?
My code:我的代码:
<button class="presentation__video-controls-play-pause" id="play-pause"> <svg class="play-pause-icon" width="22" height="29" viewBox="0 0 22 29"> <use href="img/icons/sprite.svg#play"></use> </svg> </button>
you have to make padding and margin of parent 0你必须制作父 0 的填充和边距
<button class="presentation__video-controls-play-pause" id="play-pause" style="padding:0px;margin:0px;"> <svg class="play-pause-icon" width="22" height="29" viewBox="0 0 22 29"> <use href="img/icons/sprite.svg#play"></use> </svg> </button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.