左列的svg在页面加载时会"跳动"。当你第一次打开URL时,它会变得非常大,然后由于某种奇怪的原因缩小到正确的大小。我该如何解决这个问题?
我已经尝试了从百分比高度到vh的所有方法。我需要调整视口吗?谢谢您的帮助。
我已经尝试了从百分比高度到vh的所有方法。我需要调整视口吗?谢谢您的帮助。
style.css
和bootstrap.css
文件直到稍后才会被加载,因此在此之前,SVG将占用整个页面。<svg width="662px" ...
为页面加载添加具体值:
<svg style="width:100px;height:100px;" class="svgClass"></svg>
允许CSS在之后生效:
jQuery(document).ready(function($) {
//SVGs are huge upon first loading when using percents. So, set initial values to px and then remove
$("svgClass").removeAttr("style");
});
我假设您需要的类类似于以下内容:
svgClass{
width:25%;
height:25%;
}