svg背景缩放与填充不同

时间:2015-08-13 15:51:07

标签: css svg

我将svg设置为div的背景图像(设置为表格单元格,但现在不是重点)。它伸展以适应空间,这就是我想要的,我设置了一些填充(IN%单位)以保持图像内的文本。现在的问题是,缩放视口或仅更改div填充的高度和图像高度的变化会有所不同,因此文本定位会被加扰。这是css代码:

#contenuto {
  border: 0px solid;
  width: 79%;
  display: table-cell;
  font-size: 1.0em;
  padding-top: 1.5%;
  padding-bottom: 1.5%;
  padding-right: 5%;
  padding-left: 7%;
  background: url(./pic/template.svg) no-repeat;
  background-size: auto 100%;
  background-position:center center;
  background-origin: border-box;
}

我猜错了svg文件:

<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 400 640" preserveAspectRatio="none">

我该怎么办?

0 个答案:

没有答案
相关问题