【改】 html5 中tab页面的简单转换

来源:互联网 发布:mac视频和音频不同步 编辑:程序博客网 时间:2024/06/11 01:46

.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页面:

<!DOCTYPE html><html><head>  <meta charset="UTF-8">  <title>CSS3外观漂亮淡入淡出Tab菜单演示</title>    <link rel="stylesheet" href="css/style.css" media="screen" type="text/css" /></head><body>  <article class="tabs"  id="div1"><input checked id="one" name="tabs" type="radio">  <label for="one">Tab One</label>    <input id="two" name="tabs" type="radio" value="Two">    <label for="two">Tab Two</label>    <input id="three" name="tabs" type="radio">    <label for="three">Tab Three</label>    <input id="four" name="tabs" type="radio">    <label for="four">Tab Four</label>    <div class="panels">    <div class="panel">div1    </div>    <div class="panel">    div2    </div>    <div class="panel">    div3    </div>    <div class="panel">    div4    </div></div>    </article></body></html>


原创粉丝点击