纯CSS内容选项卡 - 无法获取要显示的内容

时间:2013-11-04 07:11:01

标签: css

我正在尝试制作一组​​标签,每个标签都显示不同的内容,但在每个标签的内容应显示的区域中,我什么也看不见。我尝试了几种不同的在线教程技术,但我仍然坚持我做错了。我已将内容的不透明度设置为零,我试图触发更改为100,但如果有更好的方法让我知道。

如果可能的话,我正试图将它保留给CSS。

HTML:

<!DOCTYPE html>

<html>
<head>
    <title>Pure CSS Tabs</title>
    <link href="css/actorpage.css" type="text/css" rel="stylesheet">
</head>
<body>
    <div class="tabs">
        <input id="tab1" type="radio" name="radio" class="UploadAudio" value="checked" />
        <label for="tab1">Upload Audio</label>
        <input id="tab2" type="radio" name="radio" class="UploadVideo" />
        <label for="tab2">Upload Video</label>
        <input id="tab3" type="radio" name="radio" class="UpdateResume" />
        <label for="tab3">Update Resume</label>
        <input id="tab4" type="radio" name="radio" class="MyAccount" />
        <label for="tab4">My Account</label>
            <div class="content">
                <div class="filler">
                    <div id="content1" class="UploadAudio">
                        <p>1</p>
                    </div>
                    <div id="content2" class="UploadVideo">
                        <p>2</p>
                    </div>                  
                    <div id="content3" class="UpdateResume">
                        <p>3</p>
                    </div>
                    <div id="content4" class="MyAccount">
                        <p>4</p>
                    </div>
                </div>
            </div>
    </div>
</body>

CSS:

html, body {
font-family: verdana, helvetica;
}

.tabs {
animation: fadein .6s ease-in;
position: auto;
margin: 50px auto;
width: 90%;
height: 500px;
border-radius: 25px 25px 0px 25px;
z-index: 100;
}

.tabs input {

position: absolute;
height: 40px;   
opacity: 0;
}
.tabs > label {
transition: .5s ease 0;
margin: 0;
padding: 20px 2em;
position: relative;
border: 1px solid black;
line-height: 40px;
height: 40px;
background-color: white;
text-transform: uppercase;
}

.tabs > input:hover + label {
background-color: white;
}

.tabs > input[type="radio"]:checked + label {
    display: inline-block;
    background-color: white;
    border-bottom: 1px white;
    margin-bottom: -1px;
    box-shadow: 0 0 0 0;
    opacity: 100;
    z-index: 100;
}

.content{
opacity: 0;
border: 1px solid black;
background-color: white;
padding: 10px 10px; 
height: 100%;
overflow: auto;

box-shadow: 0 0 20px #444;
-moz-box-shadow: 0 0 20px #444;
-webkit-box-shadow: 0 0 20px #444;

border-radius: 0 5px 5px 5px;
-moz-border-radius: 0 5px 5px 5px;
-webkit-border-radius: 0 5px 5px 5px;

}

1 个答案:

答案 0 :(得分:0)

删除不透明度:0级“内容”。 尝试将类.hide {display:none;}添加到所有#content1,#content2,#content3,#content4,并仅为已激活标签的内容删除它。

相关问题