Jam*_*123 2 html css css3 css-shapes
我最后创建了侧边栏菜单.现在我需要在所选项目上创建功能区,如显示图像(红色)(我需要真正的灰色色带).但我不想使用图像背景并只使用css类.所以动态我可以删除类名并添加到另一个项目.
我有一个you_are_here选择项目的课程,我想要看到功能区.有可能吗?

<ul class="outer">
<li>
<p class="top">My Account</p>
<ul class="inner">
<li><a href="#">My Account Home</a></li>
</ul>
</li>
<li>
<p>Demographics</p>
<ul class="inner">
<li><a href="#">Addresses</a></li>
<li class="you_are_here"><a href="#">Contact Information</a></li>
<li><a href="#">Photo</a></li>
<li><a href="#">Change Password</a></li>
</ul>
</li>
</ul>
.outer P, .inner P { padding: 0.25em 0.75em; }
.outer>LI>P { font-weight: bolder; margin: 1em 0 0 0.5em; }
.outer>LI>P.top {
margin: 0; background: #eee; background: linear-gradient(0deg, #DCDCDC, #F6F6F6);
-webkit-box-shadow: 0 0 20px rgba(219,215,219,1);
-moz-box-shadow: 0 0 20px rgba(219,215,219,1);
-ms-box-shadow: 0 0 20px rgba(219,215,219,1);
border-radius: 10px 10px 0px 0px;
-moz-border-radius: 10px 10px 0px 0px;
-webkit-border-radius: 10px 10px 0px 0px;
border: 1px solid #bbbbbb;
font-size: 150%;
background-repeat:no-repeat;
-webkit-background-size:120%;
}
.outer {
border: 1px solid #bbb;
-webkit-box-shadow: 0 0 20px rgba(219,215,219,1);
-moz-box-shadow: 0 0 20px rgba(219,215,219,1);
-ms-box-shadow: 0 0 20px rgba(219,215,219,1);
box-shadow: 0 0 20px #dbd7db;
box-shadow: 0 0 20px rgba(219,215,219,1);
-ms-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
-moz-border-radius: 10px 10px 10px 10px;
-webkit-border-radius: 10px 10px 10px 10px;
}
.outer { padding: 0;width: 90%;font-family: "Open Sans", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; }
UL.outer, UL.inner { list-style: none; padding: 0 }
.outer LI { padding: 0; border: none; }
.inner LI { padding: 0.25em 1.75em; border: 1px solid white;font-family: "Open Sans", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; }
.inner LI:hover { border: 1px solid #ddd; background: #eee; }
LI.you_are_here { background: #ddd; border: 1px solid #bbb; }
LI.you_are_here A { color: black; text-decoration: none; font-weight: bolder; }
Run Code Online (Sandbox Code Playgroud)
这样的事情

这将必须适应您的需要,但使用伪元素的东西可以使这成为可能:
.box{
height:300px;
width:300px;
box-shadow:inset 0 0 15px #222;
position:relative;
margin:0 auto;
background:gray;
}
.active{
position:absolute;
top:30px;
left:-5%;
height:30px;
width:105%;
background:tomato;
border-radius: 5px 0 0 0;
}
.active:before{
content:"";
position:absolute;
height:16px;
top:5px;
left:0;
width:100%;
border-top:2px dashed red;
border-bottom:2px dashed red;
}
.active:after{
content:"";
position:absolute;
right:-10px;
height:20px;
width:20px;
top:5px;
background:tomato;
border-radius: 0 5px 0 0;
transform:rotate(45deg);
}
.active a{
position:absolute;
top:0;
left:0;
height:100%;
width:100%;
text-align:center;
display:inline-block;
text-decoration:none;
line-height:30px;
}
.active a:after{
content:"";
position:absolute;
bottom:-15px;
left:6px;
height:30px;
width:30px;
background:darkred;;
transform:rotate(45deg);
z-index:-2;
}Run Code Online (Sandbox Code Playgroud)
<div class="box">
<div class="active">
<a href="#">some text</a>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
注意
transform属性也需要前缀.