css+js实现响应式自适应顶部菜单导航条效果代码

代码语言:html

所属分类:响应式

代码描述:css+js实现响应式自适应顶部菜单导航条效果代码,兼容pc端和手机移动端显示。

代码标签: css js 响应式 自适应 顶部 菜单 导航条

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<style>
    :root {
    --primary: #F4BD50;
    --background: #191919;
    --navbar-height: 48px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Poppins, sans-serif;
}

.background {
    display: block;
    width: 100vw;
    height: 100vh;
    opacity: 1;
    z-index: 1;
    background-size: cover;
    background-repeat: no-repeat;
}

.menu__wrapper {
    display: flex;
    position: relative;
    flex-direction: row;
    z-index: 2;
}

.menu__bar {
    position: fixed;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row;
    padding: 0 1rem;
    gap: 2rem;
    background: var(--background);
    height: 4rem;
    opacity: 0.9;

}

.menu-icon {
    cursor: pointer;
    display: flex;
    height: 2rem;
    width: 2rem;
}

.navigation {
    display: flex;
    flex-direction: row;
    list-style-type: none;
    align-ite.........完整代码请登录后点击上方下载按钮下载查看

网友评论0