我试图创建一个类似于此设计的导航栏
但无法识别
我现在所做的是在下面的Code Snippet上,请检查并指导我
.container {
width: 350px;
border: 1px solid #CCCCCC;
}
.left-nav {
list-style-type: none;
}
.left-nav li {
width: 250px;
height: 50px;
margin: 0 0 10px;
}
.left-nav li a {
background-color: #030406;
line-height: 50px;
color: #FFFFFF;
text-decoration: none;
text-align: center;
display: block;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
letter-spacing: 1px;
-webkit-box-shadow: 0 7px 4px -4px #1c8eff;
-moz-box-shadow: 0 7px 4px -4px #1c8eff;
box-shadow: 0 7px 4px -4px #1c8eff;
}
.left-nav li a:hover {
background-color: #000D51;
}

<div class="container">
<ul class="left-nav">
<li><a href="">Home</a></li>
<li><a href="">About Us</a></li>
<li><a href="">Services</a></li>
<li><a href="">FAQs</a></li>
<li><a href="">Contact Us</a></li>
</ul>
</div>
&#13;
答案 0 :(得分:3)
这是我的尝试,尝试尽可能接近匹配。
这完全是关于内部渐变,阴影和边框的细节。
.container {
width: 350px;
border: 1px solid #CCCCCC;
background: #0d0e0f;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#0d0e0f+0,272a2d+51,0d0e0f+100 */
background: #0d0e0f;
/* Old browsers */
background: -moz-linear-gradient(left, #0d0e0f 0%, #272a2d 51%, #0d0e0f 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(left, #0d0e0f 0%, #272a2d 51%, #0d0e0f 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #0d0e0f 0%, #272a2d 51%, #0d0e0f 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0d0e0f', endColorstr='#0d0e0f', GradientType=1);
/* IE6-9 */
}
.left-nav {
list-style-type: none;
}
.left-nav li {
width: 250px;
height: 50px;
margin: 0 0 10px;
}
.left-nav li a::before {
content: '';
position: absolute;
right: -1px;
top: -5px;
height: 0;
width: 0;
display: block;
border-right: 2px solid rgba(255, 255, 255, 0.3);
border-bottom: 2px solid rgba(255, 255, 255, 0.3);
border-left: 2px solid rgba(255, 255, 255, 0);
border-top: 2px solid rgba(255, 255, 255, 0);
}
.left-nav li a::after {
content: '';
position: absolute;
right: -1px;
bottom: -5px;
height: 0;
width: 0;
display: block;
border-right: 2px solid rgba(255, 255, 255, 0.3);
border-top: 2px solid rgba(255, 255, 255, 0.3);
border-left: 2px solid rgba(255, 255, 255, 0);
border-bottom: 2px solid rgba(255, 255, 255, 0);
}
.left-nav li a {
position: relative;
background-color: #030406;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#373f49+0,080b0f+50,222f3e+100 */
background: #373f49;
/* Old browsers */
background: -moz-linear-gradient(left, #373f49 0%, #080b0f 50%, #222f3e 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(left, #373f49 0%, #080b0f 50%, #222f3e 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #373f49 0%, #080b0f 50%, #222f3e 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#373f49', endColorstr='#222f3e', GradientType=1);
/* IE6-9 */
line-height: 50px;
color: #90a1b6;
text-decoration: none;
text-align: center;
display: block;
font-size: 14px;
font-family: Helvetica, Arial, 'sans-serif';
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
letter-spacing: 1px;
-webkit-box-shadow: 0 1px 0px 0 rgba(0, 0, 0, 1), 0 6px 4px -4px #1c8eff, inset 0 0 20px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 1px 0px 0 rgba(0, 0, 0, 1), 0 6px 4px -4px #1c8eff, inset 0 0 20px rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 0px 0 rgba(0, 0, 0, 1), 0 6px 4px -4px #1c8eff, inset 0 0 20px rgba(0, 0, 0, 0.3);
border-top: 1px solid rgba(255, 255, 255, 0.1);
border-right: 1px solid rgba(255, 255, 255, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.left-nav li a:hover {
color: #FFF;
background-color: #000D51;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#1e87f3+0,051e68+27,000245+27,0269ca+100 */
background: #1e87f3;
/* Old browsers */
background: -moz-linear-gradient(left, #1e87f3 0%, #051e68 27%, #000245 27%, #0269ca 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(left, #1e87f3 0%, #051e68 27%, #000245 27%, #0269ca 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #1e87f3 0%, #051e68 27%, #000245 27%, #0269ca 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e87f3', endColorstr='#0269ca', GradientType=1);
/* IE6-9 */
}
.left-nav li a:hover::before {
border-right: 2px solid rgba(26, 119, 207, 1);
border-bottom: 2px solid rgba(26, 119, 207, 1);
border-left: 2px solid rgba(26, 119, 207, 0);
border-top: 2px solid rgba(26, 119, 207, 0);
}
.left-nav li a:hover::after {
border-right: 2px solid rgba(26, 119, 207, 1);
border-top: 2px solid rgba(26, 119, 207, 1);
border-left: 2px solid rgba(26, 119, 207, 0);
border-bottom: 2px solid rgba(26, 119, 207, 0);
}
<div class="container">
<ul class="left-nav">
<li><a href="">Home</a></li>
<li><a href="">About Us</a></li>
<li><a href="">Services</a></li>
<li><a href="">FAQs</a></li>
<li><a href="">Contact Us</a></li>
</ul>
</div>
答案 1 :(得分:1)
我使用Serg Chernata的代码来构建它。非常感谢Serg,我喜欢http://colorzilla.com/gradient-editor/:D
@Kashif Latif:这应该更接近.. :))
.container {
width: 350px;
border: 1px solid #CCCCCC;
background: #0d0e0f;
}
.left-nav {
list-style-type: none;
}
.left-nav li {
width: 250px;
height: 50px;
margin: 0 0 10px;
}
.left-nav li a::before{
content: '';
position: absolute;
right: -1px;
top: -5px;
height: 0;
width: 0;
display:block;
border-right: 2px solid rgba(255,255,255,0.3);
border-bottom: 2px solid rgba(255,255,255,0.3);
border-left: 2px solid rgba(255,255,255,0);
border-top: 2px solid rgba(255,255,255,0);
}
.left-nav li a::after{
content: '';
position: absolute;
right: -1px;
bottom: -5px;
height: 0;
width: 0;
display:block;
border-right: 2px solid rgba(255,255,255,0.3);
border-top: 2px solid rgba(255,255,255,0.3);
border-left: 2px solid rgba(255,255,255,0);
border-bottom: 2px solid rgba(255,255,255,0);
}
.left-nav li a {
position: relative;
background-color: #030406;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#1e87f3+0,2b2b2b+0,282828+27,141414+27,3d3d3d+100 */
background: #595959; /* Old browsers */
background: -moz-linear-gradient(left, #595959 0%, #282828 27%, #141414 27%, #3d3d3d 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(left, #595959 0%, #282828 27%,#141414 27%,#3d3d3d 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #595959 0%, #282828 27%,#141414 27%,#3d3d3d 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e87f3', endColorstr='#3d3d3d',GradientType=1 ); /* IE6-9 */
line-height: 50px;
color: #90a1b6;
text-decoration: none;
text-align: center;
display: block;
font-family: Helvetica, Arial, 'sans-serif';
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
letter-spacing: 1px;
-webkit-box-shadow: 0 1px 0px 0 rgba(0,0,0,1), 0 6px 4px -4px #1c8eff, inset 0 0 20px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 1px 0px 0 rgba(0,0,0,1), 0 6px 4px -4px #1c8eff, inset 0 0 20px rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 0px 0 rgba(0,0,0,1), 0 6px 4px -4px #1c8eff, inset 0 0 20px rgba(0, 0, 0, 0.3);
border-top: 1px solid rgba(255, 255, 255, 0.1);
border-right: 1px solid rgba(255, 255, 255, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.left-nav li a:hover {
color: #FFF;
background-color: #000D51;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#1e87f3+0,051e68+27,000245+27,0269ca+100 */
background: #1e87f3;
/* Old browsers */
background: -moz-linear-gradient(left, #1e87f3 0%, #051e68 27%, #000245 27%, #0269ca 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(left, #1e87f3 0%, #051e68 27%, #000245 27%, #0269ca 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #1e87f3 0%, #051e68 27%, #000245 27%, #0269ca 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e87f3', endColorstr='#0269ca', GradientType=1);
/* IE6-9 */
}
.left-nav li a:hover::before{
border-right: 2px solid rgba(26,119,207,1);
border-bottom: 2px solid rgba(26,119,207,1);
border-left: 2px solid rgba(26,119,207,0);
border-top: 2px solid rgba(26,119,207,0);
}
.left-nav li a:hover::after{
border-right: 2px solid rgba(26,119,207,1);
border-top: 2px solid rgba(26,119,207,1);
border-left: 2px solid rgba(26,119,207,0);
border-bottom: 2px solid rgba(26,119,207,0);
}
&#13;
<div class="container">
<ul class="left-nav">
<li><a href="">Home</a></li>
<li><a href="">About Us</a></li>
<li><a href="">Services</a></li>
<li><a href="">FAQs</a></li>
<li><a href="">Contact Us</a></li>
</ul>
</div>
&#13;
答案 2 :(得分:0)
我使用了CSS线性greadient效果。 请看:W3Schools Link
这是我到目前为止所做的链接: https://jsfiddle.net/ev1gjqL1/
background-image:
linear-gradient(
to right,
#197be2,
#091458,
#091458,
#197be2
);