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

HTML/CSS求助:Logo与菜单栏滚动下移及<li>项目符号不显示问题

问题解决指南

1. 滚动页面时Logo和菜单栏下移的修复

你的header已设置position: fixed,但滚动下移的问题来自两个点:一是.logo用了百分比单位的padding-top/padding-left,二是:root里错误设置了min-height属性。

修改步骤:

  • 删掉:root中的min-height: 175vh,页面高度控制交给body即可
  • 给header添加固定内边距,替代.logo的padding设置
  • 移除.logo的padding-left和padding-top

修改后的相关CSS代码:

:root{
    --bg-color: linear-gradient(#dbd7d6 0%, #787878 120%);
    --text-color: #fff;
    --main-color: #0b0d0b;
}

header{
    position: fixed;
    width: 100%;
    font-family: 'Poppins', sans-serif;
    top: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    transition: all .50s ease;
    padding: 1rem 4%; /* 添加固定内边距 */
}

.logo{
    display: flex;
    align-items: center;
    /* 移除原有的padding-left和padding-top */
}

2.
  • 项目符号不显示的修复
  • 全局选择器*里的list-style: none;会移除所有列表的项目符号。要让.navbar中的<li>显示符号,需单独给它恢复样式:

    添加以下CSS代码:

    .navbar li{
        list-style-type: disc; /* 可根据需求换成circle、square等样式 */
        margin-right: 1rem; /* 可选:给符号和文字增加间距 */
    }
    

    注意:如果你的.navbar设置了display: flex;,列表会横向排列,项目符号可能和文字拥挤。若需要纵向列表,删掉.navbar的display: flex;即可。

    内容的提问来源于stack exchange,提问作者AK T

    相关产品推荐
    方舟 Agent Plan

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

    最近更新时间:2026.07.25 03:44:57