html - flexbox 内容溢出

标签 html css

我正在尝试制作一个页脚,我为三列设置了三个 div,并在 flex 和 flex div 上设置了容器显示,设置为 1 以成为相等的列,但是当我在其中放置一个段落时,它会出现在容器之外

.footer{
    background: #303036;
    color:#d3d3d3;
    height:400px;
    position: relative;
}

.footer .footer-content{
    display:flex;
    border:1px solid red;
    height:350px;
}

.footer .footer-content .footer-section{
    padding: 20px;
    flex:1;
    border:1px solid white;
}

        <div class="footer">
              <div class="footer-content">
                  <div class="footer-section about">
                  <h1 class="logo-text"><span >V</span>Tech</h1>
                            <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>

                  </div>
                        <div class="footer-section links"></div>

                        <div class="footer-section contact-form"></div>


              </div>


        </div>

最佳答案

Just remove height

.footer{
    background: #303036;
    color:#d3d3d3;
    position: relative;
}

.footer .footer-content{
    display:flex;
    border:1px solid red;
}

.footer .footer-content .footer-section{
    padding: 20px;
    flex:1;
    border:1px solid white;
}
   <div class="footer">
              <div class="footer-content">
                  <div class="footer-section about">
                  <h1 class="logo-text"><span >V</span>Tech</h1>
                            <p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>

                  </div>
                        <div class="footer-section links"></div>

                        <div class="footer-section contact-form"></div>


              </div>


        </div>

关于html - flexbox 内容溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58362977/

相关文章:

html - 奇怪的 IE7 行为(或不)

html - 在 IE 中工作正常但在 Firefox 和 Chrome 中不工作

html - 使用 flex 的响应式导航栏不会折叠

html - 对 css 和 html 没有响应

html - Google Chrome 和 Firefox 之间的不同外观

java - 像 java 中的库一样的 jquery

html - 自定义列表样式不起作用

jquery - 如何在免费的 jqgrid 中不为工具栏选择元素生成上下文菜单

jquery - 在 Google Chrome 中禁用 &lt;input type ="color"> 的颜色选择器

html - 有 .space 在悬停时改变颜色