html - 我的背景图像与我的导航栏重叠?
问题描述
* {
box-sizing: border-box;
padding: 0%;
margin: 0%;
}
#navigation{
position:fixed;
width: 100%;
z-index: 2;
display: flex;
align-items: center;
justify-content: center;
height: 7rem;
box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.829), 0 6px 30px 0 rgba(0, 0, 0, 0.19);
}
.logo{
flex:0.7;
width: 3rem;
z-index: 2;
}
#nav-links{
flex: 2;
z-index: 2;
}
#nav-links ul{
display: flex;
z-index: 2;
}
#nav-links ul li{
list-style: none;
font-size: 1.6rem;
padding: 0rem 1rem;
}
#nav-links ul li a{
text-decoration: none;
padding: 0rem 2.5rem;
color: rgb(6, 177, 20);
font-family: sans-serif;
font-weight: 500;
}
#btns{
flex: 0.7;
}
#cirlce{
height: 49rem;
width: 100%;
margin-top: 0px;
top: 7rem;
z-index: 1;
position: absolute;
clip-path: circle(62.2% at 50% 0%);
background-color: black;
background-image: url(./shrishti-flowers-2.jpg);
background-repeat: no-repeat;
background-size: 100% 50rem;
background-attachment: fixed;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link
href="https://fonts.googleapis.com/css2?family=Alegreya+Sans:wght@400;500&family=Ballet&family=Roboto&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="terms.css" />
<script
src="https://kit.fontawesome.com/dcd878f67c.js"
crossorigin="anonymous"
></script>
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@500&display=swap"
rel="stylesheet"
/>
</head>
<body>
<header>
<div id="navigation">
<div class="logo">
<img src="./SHRISHTI FLOWERS - Copy.png" alt="" style="height: 7rem; width: 7rem;">
</div>
<div id="nav-links">
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">HOME</a></li>
<li><a href="#">HOME</a></li>
<li><a href="#">HOME</a></li>
</ul>
</div>
<div id="btns">
<button id="complaint" class="btns">complaint</button>
<button id="contact" class="btns">Contact us</button>
</div>
</div>
</header>
<div id="cirlce"></div>
</body>
</html
大家好,我遇到了一个问题,我不知道如何发送这个半圆,我是 CSS 新手,对 z 索引不太了解。(图像不可见,所以我使用了黑色背景)。如果你们能解决这个问题,我会很高兴。(对不起我的英语不好)......................
解决方案
尝试添加background-color
到导航栏!
推荐阅读
- sql - 从数组中查找包含属性组合的所有记录
- r - r 是否可以进行任何更改来加速我的并行化代码,这些代码组合了栅格、执行一些栅格代数并写出结果
- r - 创建列表的所有组合的数据框
- cvxpy - 在 cvxpy 0.4.10 但不是 1.0.18 中获得“无法乘以 AFFINE 和 CONVEX”
- android-studio - ExampleInstrumentedTest 出现 java.lang.ClassNotFoundException 错误
- flutter - 继承的小部件和导航抽屉。在 null 上调用了 getter 块
- excel - 根据名称(文本)计算哪个分数更高(值)
- javascript - 将文本上的句子转换为链接
- sql - 插入期间对整数进行 MS SQL 舍入 | VBA
- javascript - 处理来自 JSON 的 POST 数组对象,避免错误 ECONNREFUSED 套接字挂起