我在这里有一个测试网站:
http://www.hugoproject.com/test.html
我正在尝试将第二行书图标放在第一行之下,但无论我尝试什么都行不通。为了澄清这种情况,下面的代码会显示一个书籍图标:
<div class="project">
<a href="#" class="HS" class="project-link">Arrow<span></span></a>
</div>
当我有两组代码时,会出现两个图标,当有三组代码时,会出现三个图标。但如果我有四组或更多组代码,则只出现三个图标!我想要额外的代码集来使图标低于前三个。
此时,当您调整浏览器窗口大小时,这会使顶行图标动态调整大小。我想保留此功能,并使两行图标都适合一页,这样就没有滚动条了。
有什么想法吗?
HTML
<div id="content">
<div id="home-projects-wrapper">
<h1 class="home">Hello! My name is Brandon</h1>
<div id="home-projects">
<div id="projects" class="circle">
<div class="project-group">
<div class="project">
<a href="#" class="HS" class="project-link">Arrow<span></span></a>
</div>
<div class="project">
<a href="#" class="HS" class="project-link">Arrow<span></span></a>
</div>
<div class="project">
<a href="#" class="HS" class="project-link">Arrow<span></span></a>
</div>
<div class="project">
<a href="#" class="HS" class="project-link">Arrow<span></span></a>
</div>
</div>
</div>
</div>
</div>
</div>
CSS
#container {
transition: left .3s;
-moz-transition: left .3s;
-webkit-transition: left .3s;
position: absolute;
width: 100%;
height: 100%;
left: 0;
overflow-x: hidden;
}
#container.open {
left: 270px;
position: absolute;
width: 100%;
height: 100%;
transition: left .3s;
-moz-transition: left .3s;
-webkit-transition: left .3s;
overflow-x: hidden;
}
#content {
width: 80%;
max-width: 1170px;
margin: 7% auto;
position: relative;
font-size: 14px;
line-height: 22px;
color: #777777;
}
.page-template-page-templateshome-php #content {
width: auto;
margin: 0 auto;
position: static;
}
.single-post #content {
width: 60%;
}
#home-projects {
text-align: center;
overflow: hidden;
position: relative;
}
#projects {
width: 100%;
}
.project-group {
width: 100%;
height: 100%;
position: absolute;
}
.project {
float: left;
text-align: center;
width: 33.3%;
height:100%;
}
.project-link {
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-color: #adadad;
position: relative;
overflow: hidden;
display: inline-block;
width: 80%;
}
.circle .project-link, .circle .project-link .hover {
border-radius: 100%;
-moz-border-radius: 100%;
-webkit-border-radius: 100%;
}
.project-link .hexagon-top {
content: '';
display: block;
position: absolute;
left: 0;
border-style: solid;
border-bottom-color: transparent;
border-left-color: #dfdfdf;
border-right-color: #dfdfdf;
width: 0;
height: 0;
z-index: 2;
}
.project-link .hexagon-bottom {
content: '';
display: block;
position: absolute;
left: 0;
bottom: 0;
border-style: solid;
border-top-color: transparent;
border-left-color: #dfdfdf;
border-right-color: #dfdfdf;
width: 0;
height: 0;
z-index: 2;
}
.project-link .hover {
position: absolute;
width: 100%;
height: 100%;
font-size: 14px;
text-align: center;
color: #fff;
background: #ec6136;
text-decoration: none;
text-transform: uppercase;
display: block;
opacity: 0;
transition: all .3s;
-moz-transition: all .3s;
-webkit-transitin: all .3s;
}
.project-link .hover-text {
display: block;
margin-top: 45%;
}
.project-link .hover-text:after {
content: '>';
font-family: 'icon';
font-size: 12px;
margin-left: 15px;
}
.project-link:hover > .hover {
opacity: .9;
}
答案 0 :(得分:0)
我会为书籍设置div
容器,其设置宽度等于books
+ margins
的宽度。
然后将图书div
设置为"float: left;"
,每行应放3本书。
如果你想保持自动缩放,你应该用你目前正在做的百分比来做所有这些。
答案 1 :(得分:0)
如果您想继续使用现有产品,只需从.project-group
中删除position:absolute答案 2 :(得分:0)
您需要为块定义高度,即
.project {
float: left;
text-align: center;
width: 33.3%;
height: 290px;
}
.HS {
display: inline-block;
position: relative;
text-indent: -9999px;
width: 100%;
height: 290px;
background-image: url("http://www.hugoproject.com/ftp1/images/icons.png");
background-position: 0px 0px;
background-size: 800%;
}
但这并不能完全解决你的问题。也许你想在盒子里面使用图像而不是背景图像/图标。您也可以使用JavaScript / jQuery计算新维度。