html - 页脚背景颜色消失,页脚文本在屏幕中间 float

标签 html css flexbox

因此,当在桌面上全屏显示时,您可以看到页脚没问题,但当调整到较窄的屏幕时,页脚的蓝色背景消失,页脚的文本停留在屏幕中间。

我们正在为我学校的生物化学系创建这个网页并恢复它的学分。

html页面是studentawards,css是main和awards。内容在这repository .

编辑 jsfiddle .

编辑 2 这似乎在 jsfiddle 中工作得很好,但它不适用于 Windows 10 Chrome 或 firefox。

  <!DOCTYPE html>
 <html lang="en">
<head>
    <link href="main.css" rel="stylesheet">
    <link href="awards.css" rel="stylesheet">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

</head>
<body>
    <header>
    </header>
    <div id="seperator"></div>
    <div id="content">
        <nav>
            <ul>
               <li><a href="index.html">Home</a></li>
                <li><a href="teaching.html">Teaching</a></li>
                <li><a href="research.html">Research</a></li>
                          <li><a href="publications.html">Publication</a></li>
                <li><a href="studentawards.html">Student Awards</a></li>
                <li><a href="gallery.html">Gallery</a></li>
                <li><a href="contact.html">Contact</a></li>
            </ul>
            <div id="sponsorLogo">
                <img id ="logo" src="resources/Acs.png" alt="ACS" height="30%" width="30%"><br><br>
                <img id ="logo" src="resources/nationalInstitudeofHealth.png" alt="ACS" height="30%" width="30%"><br><br>
                <img id ="logo" src="resources/Nsf.png" alt="ACS" height="30%" width="30%"><br><br>
                <img id ="logo" src="resources/Kbrin.png" alt="Kbrin" height="40%" width="40%"><br><br>
                <img id ="logo" src="resources/Cinsam.png" alt="ACS" height="80%" width="80%"><br><br>
                </div>
        </nav>
        <main>
            <!--THIS IS WHAT GETS CHANGED ON THE DIFFERENT PAGES-->
                <div class="awards">
                    <ul class="awardsItem">
                        <h3>KAS Undergraduate <br> Oral Presentation Competition</h3>
                        <hr class="horizontalRule">
                        <strong>2018: </strong><li>1st. Place Ayanav Roy</li>
                        <li>2nd. Place Quynh Nguyen</li>
                        <strong>2016: </strong><li>1st. Place Quynh Nguyen</li>
                        <strong>2015: </strong><li>1st. Place Alma Onate</li>
                        <strong>2014: </strong><li>3rd. Place Thuy Donna Do</li>
                        <strong>2013: </strong><li>1st. Place Thuy Donna Do</li>
                        <strong>2011: </strong><li>2nd. Place Adam McCallum</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>UR-STEM Summer Research Award</h3> <br>
                        <hr class="horizontalRule">
                        <strong>2018: </strong><li>Elizabeth Osifalujo</li>
                        <li>Kayla Laverne   </li>
                        <strong>2016: </strong><li>Andrew Quillen</li>
                        <li>Quynh Nguyen    </li>
                        <strong>2013: </strong><li>Emily Hogle</li>
                        <li>Janelle Tucker</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>NKU Dorothy Westerman Hermann <br> Undergraduate Research Award </h3>
                        <hr class="horizontalRule">
                        <strong>2018: </strong><li>Alex Rosen</li>
                        <strong>2017: </strong><li>Andrew Quillen</li>
                        <strong>2015: </strong><li>Alma Onate</li>
                        <strong>2014: </strong><li>Thuy Donna Do</li>
                        <strong>2013: </strong><li>Rebecca Kidney</li>
                        <strong>2012: </strong><li>Quintin Hauser</li>
                        <strong>2011: </strong><li>Eric Amato</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>ACS Undergraduate Award in <br> Organic Chemistry</h3>
                        <hr class="horizontalRule">
                        <strong>2016: </strong><li>Alma Onate</li>
                        <strong>2015: </strong><li>Thuy Donna Do</li>
                        <strong>2014: </strong><li>Timothy Dunn</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>Student Undergraduate <br> Research & Creative Awards (SURCA)</h3>
                        <hr class="horizontalRule">
                        <strong>2018: </strong><li>Quynh Nguyen</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>NKU Regents Award</h3> <br>
                        <hr class="horizontalRule">
                        <strong>2016: </strong><li>Alma Onate</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>NKU Greaves <br> Undergraduate Summer Research Award </h3>
                        <hr class="horizontalRule">
                        <strong>2018: </strong><li>Andrew Quillen</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>Cooper Research Excellence Scholarship</h3> <br>
                        <hr class="horizontalRule">
                        <strong>2018: </strong><li>Quynh Nguyen</li>
                        <strong>2015: </strong><li>Alma Onate</li>
                        <strong>2014: </strong><li>Thuy Donna Do</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>NKU Chemistry Department <br> Outstanding Senior Graduate</h3>
                        <hr class="horizontalRule">
                        <strong>2016: </strong><li>Alma Onate</li>
                        <strong>2015: </strong><li>Thuy Donna Do</li>
                        <strong>2014: </strong><li>Timothy Dunn</li>
                    </ul>

                    <ul class="awardsItem">
                        <h3>ACS Travel Award</h3>
                        <hr class="horizontalRule">
                        <strong>2011: </strong><li>Kevin Bonfield</li>
                    </ul>

                </div>
            <!--END OF WHAT CHANGES ON THE DIFFERENT PAGES-->
        </main>
        <div id="news">
            <a class="twitter-timeline" date-width="600" data-height="100%" data-theme="light" href="https://twitter.com/SatisfactoryAF?ref_src=twsrc%5Etfw">Tweets by SatisfactoryAF</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
        </div>
    </div>
    <div id="footer">
        <footer class="footer">
            &nbsp;&nbsp;&nbsp;&nbsp;Copyright &copy; Lili Ma, Ph.D.<br>
            &nbsp;&nbsp;&nbsp;&nbsp;Department of Chemistry & Biochemistry, Office SC 448<br>
            &nbsp;&nbsp;&nbsp;&nbsp;Northern Kentucky University at Highland Heights, KY 41099<br>
        </footer>
    </div>
</body>

任何帮助都将不胜感激,我几乎肯定它与 flex-box 有关,但由于我的导师似乎不太了解我在这里有点摸不着头脑。

我们将不胜感激。

我访问过的资源:

  • https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
  • https://stackoverflow.com/questions/50429737/sticky-footer-with-flexbox
  • https://stackoverflow.com/questions/30202294/flexbox-wraps-outside-of-container
  • https://codepen.io/noahblon/post/practical-guide-to-flexbox-dont-forget-about-flex-shrink

以上似乎都不能满足我的需要

最佳答案

 <div id="content" style="height: auto;"> replace <div id="content">

在 studentawards.html 中

关于html - 页脚背景颜色消失,页脚文本在屏幕中间 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53423218/

相关文章:

javascript - 如何让按钮在我的 html 文档中显示警告框?

javascript - 如何在两个不同的 select html 标签中禁用相同的选择

html - 如何使用 flexbox 拉伸(stretch)导航栏中的所有导航元素

html - 为显示为 :inline-block 的 div 元素设置中心位置

javascript - 如何为动态宽度内容设置动画?

css - 防止 Flex-wrap 3 :1 case

php - 创建登录表单

php - 在 HTML 中包含 php 脚本

javascript - 在 HTML 表格的每个单元格中播放音频

javascript - jQuery 获取整个输入元素,包括它的值