Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.9k views
in Technique[技术] by (71.8m points)

问一个很基础的样式问题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
.div1{
    background-color: crimson;
    height: 500px;
    display: flex;
}
.div2{
    width: 200px;
    flex-grow: 0;
    flex-shrink: 0;
    background-color: cyan;
}
.div3{
 
    display: flex;
}
.div33,.div34,.div35{
        flex: 1;
       
    }
    </style>
</head>
<body>
    <div class="div1">
        <div class="div2">123</div>
        <div class="div3">
            <div class="div33"><div class="div333">111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111</div></div>
            <div class="div34">111</div>
            <div class="div35">111</div>
        </div>
    </div>
</body>
</html>

为什么div3被撑开了,可是div1却没有被撑开还是和屏幕一样宽呢?
都已经实习几天了,还是搞不清一些基础的样式问题_(:з」∠)_


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)
.div1 {

   background-color: crimson;
   height: 500px;
   display: flex;
   border: 40px solid yellow;  //加这个你就能看到div1 最外边黄色的边框。 已经是撑开了哦

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...