美文网首页
flex实现中间内容自适应高度

flex实现中间内容自适应高度

作者: 炫海神鹰 | 来源:发表于2019-10-30 17:31 被阅读0次

dmeo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>用flex 实现中间内容自适应高度</title>
<style>
body, html {
width: 100%;
height: 100%;
}
.content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.content .flex-test {
display: flex;
/* 排列方向-自上向下 */
flex-direction: column;
flex: auto;
width: 150px;
}
.content .flex-test .test1 {
display: flex;
justify-content: center;
margin-top: 10px;
background: #c6c6c6;
}
.content .flex-test .test2{
flex: auto;
overflow-y: scroll;
height: 0;
background: #666;
}
.content .flex-test .test3{
height: 50px;
background: #ccc;
display: flex;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<div class="content">
<div class="flex-test">
<div class="test1">
<p>java</p>
<p>c++ </p>
<p>node </p>
</div>
<div class="test2">
开始~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~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文章

网友评论

      本文标题:flex实现中间内容自适应高度

      本文链接:https://www.haomeiwen.com/subject/ohhavctx.html