.tabs {
width: 100%;
max-width: 455px;
float: left;
}
#div1 input {
opacity: 0;
border: 1px solid #F0F0F0
}
#div1 label {
cursor: pointer;
background: -webkit-linear-gradient();
color: #FBFBFF;
border-radius: 5px 5px 0 0;
padding: 1.5% 3%;
float: left;
margin-right: 2px;
font: italic 1em cambria;
border: 1px solid #F0F0F0;
border-bottom-width: 0px;
}
#div1 label:hover {
background: -webkit-linear-gradient(#ECFFFF,#FDFFFF);
}
#div1 input:checked + label {
background:#ECF5FF;
color: #333;
}
.tabs input:nth-of-type(1):checked ~ .panels .panel:first-child,
.tabs input:nth-of-type(2):checked ~ .panels .panel:nth-child(2),
.tabs input:nth-of-type(3):checked ~ .panels .panel:nth-child(3),
.tabs input:nth-of-type(4):checked ~ .panels .panel:last-child {
opacity: 1;
-webkit-transition: .3s;
}
.panels {
float: left;
clear: both;
position: relative;
width: 100%;
background: #fff;
border-radius: 0 10px 10px 10px;
min-height: 480px;
border: 1px solid #F0F0F0;
}
.panel {
width: 100%;
opacity: 0;
position: absolute;
background: #fff;
border-radius: 0 10px 10px 10px;
padding: 4%;
box-sizing: border-box;
}
.panel h2 {
margin: 5px;
font-family: Arial;
}
css前端样式设置。
下边是html5页面:
CSS3外观漂亮淡入淡出Tab菜单演示
Tab One
Tab Two
Tab Three
Tab Four
div1
div2
div3
div4