You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React作品集项目:Chrome浏览器页脚下方空白问题求助

Chrome浏览器页脚下方出现空白区域的问题求助
  • 跟随YouTube React作品集教程开发,JSX及CSS代码与教程完全一致,但仅Google Chrome浏览器中页脚下方出现空白区域,Firefox、Edge浏览器无此异常,推测为浏览器兼容问题
  • 已排除悬浮导航栏对该空白问题的影响
  • 曾尝试注释全局样式index.css中的section {margin-top: 8rem;},仅能解决桌面端空白问题,移动端仍存在该情况,且此操作会破坏全局布局,因此不希望采用该方案

项目预览链接

核心代码片段

App组件JSX代码

function App() {
    return (
        <>
            <Header />
            <Nav />
            <About />
            <Experience />
            <Services />
            <Portfolio />
            <Testimonials />
            <Contact />
            <Footer />
        </>
    )
}

全局样式(index.css片段)

/* CSS Reset */
*{
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    box-sizing: border-box;
    list-style: none;
    text-decoration: none;
}
html {
    scroll-behavior: smooth;
}

::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--color-bg);
    color: var(--color-white);
    line-height: 1.7;
    background-image: url('./assets/bg-texture.png');
}

.container {
    width: var(--container-width-lg);
    margin: 0 auto;
}

section {
    margin-top: 8rem;
}

Footer组件JSX代码

function Footer(){
    return(
        <footer>
            {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
            <a href='#' className='footer__logo'>LISA</a>

            <ul className='permalinks'>
                {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
                <li><a href='#'>Home</a></li>
                <li><a href='#about'>About</a></li>
                <li><a href='#experience'>Experience</a></li>
                <li><a href='#services'>Services</a></li>
                <li><a href='#portfolio'>Portfolio</a></li>
                <li><a href='#testimonials'>Testimonials</a></li>
                <li><a href='#contact'>Contact</a></li>
            </ul>

            <div className="footer__socials">
                <a href='https://facebook.com'><FaFacebook /></a>
                <a href='https://instagram.com'><FiInstagram /></a>
                <a href='https://twitter.com'><IoLogoTwitter /></a>
            </div>

            <div className="footer__copyright">
                <small>&copy; LISA Portfolio. All rights reserved.</small>
            </div>
        </footer>
    )
}

Footer组件CSS代码

footer {
    background: var(--color-primary);
    padding: 3rem 0;
    text-align: center;
    font-size: 0.9rem;
    margin-top: 7rem;
}

footer a {
    color: var(--color-bg);
}

.footer__logo {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 2rem;
    display: inline-block;
}

.permalinks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin: 0 auto 3rem;
    padding: 0;
}

.footer__socials {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 4rem;
}

.footer__socials a {
    background: var(--color-bg);
    color: var(--color-white);
    padding: 0.8rem;
    border-radius: 0.7rem;
    display: flex;
    border: 1px solid transparent;
}

.footer__socials a:hover {
    background: transparent;
    color: var(--color-bg);
    border-color: var(--color-bg);
}

.footer__copyright {
    margin-bottom: 4rem;
    color: var(--color-bg);
}

/* MEDIA QUERIES FOR MOBILE PHONES (SMALL DEVICES) */
@media screen and (max-width: 600px){
    .permalinks {
        flex-direction: column;
        gap: 1.5rem;
    }

    .footer__socials {
        margin-bottom: 2.6rem;
    }
}

恳请有相关经验的开发者提供解决方案,谢谢!😃

内容的提问来源于stack exchange,提问作者Anthony Renzo Ferrer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 12:42:38