我有这个问题:
这是维持关系层次亲子关系的格式。
<div class="ContainerTitle">SYLLABUS:
<div class="DownloadThis"></div>
<div class="ViewThis"></div>
<div class="showHint"></div>
</div>
以下是我的代码段。请看一下并告诉我需要做什么:)
.ContainerTitle {
display: block;
/* WHY IS THIS^ NOT WORKING?????*/
background: #fff;
float: left;
padding: 15px;
padding-left: 15px;
border: solid 1px #000;
font-size: Large;
color: #000;
text-align: left;
cursor: pointer;
transition: all .1s ease-out;
}
.DownloadThis,
.ViewThis {
display: inline-block;
padding: 20px;
padding-bottom: 10px;
border: solid 1px #fff;
width: 40px;
}
.showHint {
margin-top: 20px;
background: #f1f1f1;
transition: all .9 ease-out;
}
.ContainerTitle:hover .showHint:after {
content: '*Hint: Hint Text';
transition: all .9 ease-out;
}
.ViewThis:hover + .showHint:after {
content: '*Hint: View Online';
transition: all .9 ease-out;
}
.DownloadThis:hover ~ .showHint:after {
content: '*Hint: Download This';
transition: all .9 ease-out;
}
.DownloadThis {
background: #1D9C73;
color: #fff;
}
.ViewThis {
background: #7D529E;
color: #fff;
}
.DownloadThis:hover,
.ViewThis:hover {
border: solid 1px #000;
background: #fff;
}
.DownloadThis:hover {
color: #1D9C73;
}
.ViewThis:hover {
color: #7D529E;
}
.ContainerTitle:before,
.DownloadThis:before,
.ViewThis:before {
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
padding-left: 6px;
padding-right: 8px;
font-size: 32px;
}
.ContainerTitle:before {
content: '\f0f6';
font-size: 24px;
}
.DownloadThis:before {
content: '\f019';
}
.ViewThis:before {
content: '\f06e';
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" />
<div class="ContainerTitle">TESTING:
<div class="DownloadThis"></div>
<div class="ViewThis"></div>
<div class="showHint"></div>
</div>
<div style="background: #4399CD; padding: 30px; color: #fff;display:inline-block;padding-left: 15px; ">
Sixth (6th) Semester
</div>
答案 0 :(得分:1)
.ContainerTitle {
display: block;
/* WHY IS THIS^ NOT WORKING?????*/
background: #fff;
float: left;
padding: 15px;
padding-left: 15px;
border: solid 1px #000;
font-size: Large;
color: #000;
text-align: left;
cursor: pointer;
transition: all .1s ease-out;
}
.DownloadThis,
.ViewThis {
display: inline-block;
padding: 20px;
padding-bottom: 10px;
border: solid 1px #fff;
width: 40px;
}
.showHint {
margin-top: 20px;
background: #f1f1f1;
transition: all .9 ease-out;
}
.ContainerTitle:hover .showHint:after {
content: '*Hint: Hint Text';
transition: all .9 ease-out;
}
.ViewThis:hover + .showHint:after {
content: '*Hint: View Online';
transition: all .9 ease-out;
}
.DownloadThis:hover ~ .showHint:after {
content: '*Hint: Download This';
transition: all .9 ease-out;
}
.DownloadThis {
background: #1D9C73;
color: #fff;
}
.ViewThis {
background: #7D529E;
color: #fff;
}
.DownloadThis:hover,
.ViewThis:hover {
border: solid 1px #000;
background: #fff;
}
.DownloadThis:hover {
color: #1D9C73;
}
.ViewThis:hover {
color: #7D529E;
}
.ContainerTitle:before,
.DownloadThis:before,
.ViewThis:before {
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
padding-left: 6px;
padding-right: 8px;
font-size: 32px;
}
.ContainerTitle:before {
content: '\f0f6';
font-size: 24px;
}
.DownloadThis:before {
content: '\f019';
}
.ViewThis:before {
content: '\f06e';
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" />
<div class="ContainerTitle">TESTING:
<div class="DownloadThis"></div>
<div class="ViewThis"></div>
<div class="showHint"></div>
</div>
<div style="background: #4399CD; padding: 30px; color: #fff;display:inline-block;padding-left: 15px; clear:both; float:left">
Sixth (6th) Semester
</div>
&#13;
答案 1 :(得分:1)
在div中尝试以下css( <div>Sixth (6th) Semester</div>
):
clear:both;
float:left;