如果您查看agency.css文件,您會看到懸停行爲的樣式僅爲具有組合標識的元素定義。
當前CSS:
#portfolio .portfolio-item {
right: 0;
margin: 0 0 15px;
}
#portfolio .portfolio-item .portfolio-link {
display: block;
position: relative;
margin: 0 auto;
max-width: 400px;
}
#portfolio .portfolio-item .portfolio-link .portfolio-hover {
position: absolute;
width: 100%;
height: 100%;
opacity: 0;
background: rgba(254,209,54,.9);
-webkit-transition: all ease .5s;
-moz-transition: all ease .5s;
transition: all ease .5s;
}
#portfolio .portfolio-item .portfolio-link .portfolio-hover:hover {
opacity: 1;
}
#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content {
position: absolute;
top: 50%;
width: 100%;
height: 20px;
margin-top: -12px;
text-align: center;
font-size: 20px;
color: #fff;
}
#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content i {
margin-top: -12px;
}
#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h3,
#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h4 {
margin: 0;
}
#portfolio .portfolio-item .portfolio-caption {
margin: 0 auto;
padding: 25px;
max-width: 400px;
text-align: center;
background-color: #fff;
}
#portfolio .portfolio-item .portfolio-caption h4 {
margin: 0;
text-transform: none;
}
#portfolio .portfolio-item .portfolio-caption p {
margin: 0;
font-family: "ff-enzo-web",sans-serif;
font-size: 16px;
font-style: italic;
}
#portfolio * {
z-index: 2;
}
@media(min-width:767px) {
#portfolio .portfolio-item {
margin: 0 0 30px;
}
}
所以你需要添加相應的規則對每個新的ID,你創建的,如:
#electrical .portfolio-item, #lighting .portfolio-item, #door .portfolio-item {
right: 0;
margin: 0 0 15px;
}
/*you'll need to do this for all of the above rules*/
或者,你可以爲您的三個部分中的每一部分添加一組「類別」,例如:
<section id="lighting" class="bg-light-gray portfolio">
,然後你可以改變的CSS來:
.portfolio .portfolio-item {
right: 0;
margin: 0 0 15px;
}
.portfolio .portfolio-item .portfolio-link {
display: block;
position: relative;
margin: 0 auto;
max-width: 400px;
}
.portfolio .portfolio-item .portfolio-link .portfolio-hover {
position: absolute;
width: 100%;
height: 100%;
opacity: 0;
background: rgba(254,209,54,.9);
-webkit-transition: all ease .5s;
-moz-transition: all ease .5s;
transition: all ease .5s;
}
.portfolio .portfolio-item .portfolio-link .portfolio-hover:hover {
opacity: 1;
}
.portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content {
position: absolute;
top: 50%;
width: 100%;
height: 20px;
margin-top: -12px;
text-align: center;
font-size: 20px;
color: #fff;
}
.portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content i {
margin-top: -12px;
}
.portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h3,
.portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h4 {
margin: 0;
}
.portfolio .portfolio-item .portfolio-caption {
margin: 0 auto;
padding: 25px;
max-width: 400px;
text-align: center;
background-color: #fff;
}
.portfolio .portfolio-item .portfolio-caption h4 {
margin: 0;
text-transform: none;
}
.portfolio .portfolio-item .portfolio-caption p {
margin: 0;
font-family: "ff-enzo-web",sans-serif;
font-size: 16px;
font-style: italic;
}
.portfolio * {
z-index: 2;
}
第二個選項是更容易,在我看來,當然更簡潔。
非常感謝。我知道這很簡單,我只是想念它。大! – weslangdon 2014-08-28 20:40:01