模糊效果不会覆盖整个元素(导航栏)



我想在我的网站导航栏上创建一个模糊效果,但是即使我使用background-size: cover,模糊效果也不能覆盖整个导航栏而不是一个干净的模糊效果,似乎效果有一个椭圆形。

Thanks in advance

实际结果的图片

这是我的Html代码:
<div class="navbar">
<li><a href="#">Home</a></li>
<li><a>Study</a></li>
<li><a>Skills</a></li>
<li><a href="#caroussel">Photographs</a></li>
</div>

和css代码:

.navbar{
text-align: right;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
background: rgba(0,0,0, 0.5);
backdrop-filter: blur(20px);
z-index: 9999;

background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.logo{
position: absolute;
left: 5%;
margin-top: 3px;
height: 45px;
width: auto;
float: left;
}
.navbar a{
display: block;
list-style: none;
border-bottom: 3px solid rgba(0, 0, 0, 0);
}

.navbar li a:link,
.navbar li a:visited{
color: #cccccc;
text-decoration: none;
text-transform: uppercase;
font-size: 90%;
transition: border-bottom 0.2s;
padding-bottom: 5px;
}
.navbar li {
display: inline-block;
margin-top: 20px;
padding-bottom: 5px;
margin-right: 40px;
}
.navbar li:last-child{
padding-right: 5%;
}
.navbar li a:hover,
.navbar li a:active{
border-bottom: 3px solid #cf6d17;
}

.navbar{
text-align: right;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
height:100px;
background: rgba(0,0,0, 0.5);
background-image:url('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSeGXDhAWbkYwmMnlZaIQFsUGJe4qO4fBXxqW75gbPKoafqSsIaqz6BSEdBzs3IxYt_X0M&usqp=CAU');
z-index: 9999;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.box{    
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(255, 255, 255, 0.3);
border-radius: 5px;
font-family: sans-serif;
text-align: center;
line-height: 1;
-webkit-backdrop-filter: blur(5px);
backdrop-filter: blur(5px);
height:100%;
}
.logo{
position: absolute;
left: 5%;
margin-top: 3px;
height: 45px;
width: auto;
float: left;
}
.navbar a{
display: block;
list-style: none;
border-bottom: 3px solid rgba(0, 0, 0, 0);
}

.navbar li a:link,
.navbar li a:visited{
color: #cccccc;
text-decoration: none;
text-transform: uppercase;
font-size: 90%;
transition: border-bottom 0.2s;
padding-bottom: 5px;
}
.navbar li {
display: inline-block;
margin-top: 20px;
padding-bottom: 5px;
margin-right: 40px;
}
.navbar li:last-child{
padding-right: 5%;
}
.navbar li a:hover,
.navbar li a:active{
border-bottom: 3px solid #cf6d17;
}
<div class="navbar">
<div class="box">
<li><a href="#">Home</a></li>
<li><a>Study</a></li>
<li><a>Skills</a></li>
<li><a href="#caroussel">Photographs</a></li>
</div>
</div>

相关内容

  • 没有找到相关文章

最新更新