我想在CSS中用香脂风格创建一个菜单(参见:http://img.skitch.com/20100130-pr6qp63amd1nkwy4xar2ds3xex.png)它的样子。我刚刚开始研究它,但已经锁定了......不知道如何在CSS中做到这一点。
所以主要有以下差距:
提前致谢!
答案 0 :(得分:1)
您的边框几乎必须使用背景图片。您需要的图像长度超过最长的项目。
选定的标签类应该有一个白色的边框右边,取消选中的标签应该是一个黑色边框右边。
代码:
<style type="text/css">
.menu {
margin: 0;
padding: 0;
float: left;
width: 10%;
position: relative;
left: 2px;
}
.menu li {
/* Use a background image with your lines on all four sides */
border: 2px solid black;
background-color: green;
list-style: none;
margin: 0;
padding: 0;
}
.menu .selected {
/* Use a background image with your lines and a white background inside the tab */
border-right: none;
background-color: white;
}
.body {
border: 2px solid black;
margin-left: 10%;
}
</style>
<div>
<ul class="menu">
<li class="selected">Option 1</li>
<li>Option 2</li>
<li>Option 3</li>
</ul>
<div class="body">
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
Main content here Main content here Main content here Main content here Main content here Main content here Main content here Main content here
</div>
</div>