html - 具有两列和文本区域的 Bootstrap 行填满页面

标签 html css twitter-bootstrap

我正在尝试制作一个简单的页面,该页面在一行上有一个标题,然后在一行上有两列。每列将包含一个文本区域。我希望列和文本区域填满页面的其余部分。我一直在寻找,但我无法解决这个问题。我正在使用 boostrap v4.0.0-beta.2。

这是我的片段:

  label { font-weight: bold; }
            html, body, .container-fluid {
                height: 100%;
                min-height: 100%;
            }
            textarea.form-control {
                height: 100%;
                width: 100%;
                min-height: 100%;
            }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid" style="background: #DDDDDD">
   <div class="row">
       <div class="col-lg-12 jumbotron text-center">
           <h1>Formatter</h1>
           <p>Enter raw input to see output</p> 
       </div>
   </div>
   <div class="row" style="background: #CCCCCC;">
       <div class="col-lg-6">
           <label for="input">Input:</label>
           <textarea class="form-control" id="input">
           </textarea>
       </div>
       <div class="col-lg-6">
           <label for="output">Output:</label>
           <textarea readonly class="form-control" id="output"></textarea>
        </div>
    </div>
</div>

最佳答案

在您的代码中,您将文本区域的高度设置为 100%。但这取决于它的父 div。 100% 表示其父 div 的 100%。

因此,要么您必须更改其所有父 div 样式,要么如果您可以使用 CSS3,则可以使用视口(viewport)百分比单位,例如 width: 100vwheight: 100vh (这意味着 100% 的视口(viewport)/窗口大小)。

textarea.form-control {
     height: 100vh;
     width: 100vw;
}

关于html - 具有两列和文本区域的 Bootstrap 行填满页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47306029/

相关文章:

javascript - 需要页面上其他 ID 的动画,包括 jsfiddle

javascript - 如何在打开另一个弹出窗口时隐藏一个事件的弹出窗口?

html - Bootstrap - 导航栏正在扩展

javascript - setFocus 在 mozilla 中不起作用

php - 防止默认不工作 Jscript if(confirm){}else{prevent default}

jquery - :hover issue when mouse moves over an iframe which is inside the div | Internet Explorer

Javascript 自定义表格列的能力。允许用户删除和添加新列的按钮

html - 当元素出现在不同的父元素中时,我们可以重新排序元素吗?

javascript - Bootstrap 不向右拉

html - 如何通过 xpath 或 css 选择器在 map 上定位元素