相关疑难解决方法(0)

自动调整SVG?

这是一个代码演示

我有一个未知高度的SVG.在我加载json并使用javascript + math之后我可以弄明白但是有没有我可以用来动态调整大小的CSS?

CSS:

svg {
  width: 500px;
  height: 9000px;
}
.tabme {
  border:3px solid red;
  height: 200px;
   overflow:scroll;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<div class="tabme">
  <div id="Chart">
    <div class="chartbody" />
    <svg>
      <rect width="190" y="0" height="16" x="175" />
      <rect width="190" y="20" height="16" x="175" />
      <rect width="190" y="40" height="16" x="175" />
      <rect width="190" y="60" height="16" x="175" />
      <rect width="190" y="80" height="16" x="175" />
      <rect width="190" y="100" height="16" x="175" />
      <rect width="190" y="120" height="16" x="175" />
      <rect width="190" y="140" height="16" x="175" />
      <rect …
Run Code Online (Sandbox Code Playgroud)

css svg

8
推荐指数
1
解决办法
8411
查看次数

标签 统计

css ×1

svg ×1