相关疑难解决方法(0)

在flexbox列子上高度100%

我在使用flexbox列时遇到麻烦,因为flex'd元素的子元素不会以height百分比形式响应.我只在Chrome中检查过此内容,据我所知,这只是Chrome的问题.这是我的例子:

HTML

<div class='flexbox'>
  <div class='flex'>
    <div class='flex-child'></div>
  </div>
  <div class='static'></div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.flexbox{
  position:absolute;
  background:black;
  width:100%;
  height:100%;

  display: flex;
  flex-direction:column;
}

.flex{
  background:blue;
  flex:1;
}

.flex-child{
  background:red;
  height:100%;
  width:100%;
  display:block;
}

.static{
  background:green;
  width:100%;
  height:5rem;
}
Run Code Online (Sandbox Code Playgroud)

这是CodePen.

我想要它,所以红色.flex-child填充蓝色.flex.为什么不起作用height:100%

css height google-chrome percentage flexbox

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

在Flexbox中扩展iframe

我正在尝试扩展其大小iframe以填充我的Web应用程序中的剩余空间.我知道为div(通过添加边框)分配了最大空间,但iframe高度本身并未扩展以填充整个垂直高度.

问题是row content iframe没有填满整个垂直空间,即使flexbox正在适当地分配该空间.

有任何想法吗?

.box {
  display: flex;
  flex-flow: column;
  height: 100vh;
}
.box .row.header {
  flex: 0 1 auto;
}
.box .row.content {
  flex: 1 1 auto;
}
.box .row.footer {
  flex: 0 1 40px;
}
.row.content iframe {
  width: 100%;
  border: 0;
}
Run Code Online (Sandbox Code Playgroud)
<div class="box">
  <div class="row header">
    <h1>Event Details</h1>
    <div id="container">
      <h5>Test</h5>
    </div>
    <div data-role="navbar">
      <ul>
        <li><a href="players.html" class="ui-btn-active ui-state-persist">Players</a>
        </li>
        <li><a href="games.html">Games</a>
        </li>
        <li><a href="chat.html">Chat</a>
        </li>
      </ul> …
Run Code Online (Sandbox Code Playgroud)

html css iframe css3 flexbox

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

标签 统计

css ×2

flexbox ×2

css3 ×1

google-chrome ×1

height ×1

html ×1

iframe ×1

percentage ×1