小编Kev*_*aan的帖子

css中的百分比宽度不起作用

我正在使用一种方法在css中使用视口测量来定义我的width属性,css代码:

#content {
    position: absolute;
    background-color: white;
    width: 100vw;
    top: 115px;
    bottom: 30px;
    display: table;
    z-index: 0;
}
Run Code Online (Sandbox Code Playgroud)

当我从宽度改变宽度:100vw; 宽度:100%; 我的代码不再工作了.我想更改为百分比测量,因为我发现viewport不适用于Android <4.4

其他相关的HTML和CSS代码:

HTML

  <div id="mainslide"> 
    <section id="aanbod"> 
      <div id="content" align="center">
        <table class="tablestyleorchideeaanbod">
          <tr>
            <td class="titel" width="85%">Orchidee</td>
            <td class="beschrijving" width="15%" rowspan="1" align="right">21 aug</td>
          </tr>
          <tr>
            <td class="soort">Cherry red</td>
            <td width="15%" rowspan="2" align="right"><svg height="30" width="30">
              <circle cx="15" cy="15" r="12" fill="#ff4641" />
              </svg></td>
          </tr>
          <tr>
            <td class="beschrijving"><span class="width">Aantal: 100 stuks</span>Grootte: 3 Liter</td>
          </tr>
        </table>
      </div>
    </section>

    <section>
    ..............
    </section>

    <section>
    ..............
    </section> …
Run Code Online (Sandbox Code Playgroud)

html css viewport width percentage

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

标签 统计

css ×1

html ×1

percentage ×1

viewport ×1

width ×1