【发布时间】:2018-01-04 17:33:30
【问题描述】:
我正在尝试将图像放在我网站的团队部分的中心。我有三个带有文本的图像,并且希望中心图像位于 PC、手机、ipad 等浏览器的中心。我构建了响应数据包,只需要调整 css 和 html 代码。
这是我现在拥有的:
.featured-images {
padding: 55px 0;
background: #f9b701;
text-align: center;
}
.featured-images h1 {
font-size: 44px;
color: #2d6e84;
text-transform: uppercase;
font-family: 'fjalla_oneregular';
}
.featured-images h2 {
text-align: center;
font-size: 34px;
color: #2d6e84;
font-family: 'source_sans_prolight';
}
.featured-images .hh-divider {
background: url(../img/hh-divider.png) repeat-x 50%;
margin-bottom: 50px;
margin-top: 20px;
height: 7px;
}
.featured-images .grid li .user-info ul {
margin-top: 15px !important;
}
.featured-images .grid li .user-info ul li {
width: 16%;
float: none !important;
}
.featured-images .grid li .user-info ul li a:hover {
text-decoration: none !important;
}
.featured-images .grid li .user-info {
display: inline-block;
text-align: center;
}
.featured-images .user-info img {
margin: 0 auto;
padding-bottom: 25px;
}
.featured-images .user-info h1 {
padding-bottom: 10px;
color: #2a363c;
font-size: 18px;
line-height: 22px;
font-family: 'fjalla_oneregular';
text-transform: uppercase;
}
.featured-images .user-info p {
color: #44535a;
font-size: 16px;
line-height: 24px;
font-family: 'source_sans_proregular';
text-align: center;
}
.featured-images .user-info ul {
margin: 0;
margin-top: 15px;
}
.featured-images .user-info ul li {
list-style: none;
display: inline-block;
margin: 0px auto;
}
.featured-images .user-info ul li [class^="fw-icon-"] {
border-radius: 23px;
color: #f9b701;
font-size: 10px;
display: inline-block !important;
cursor: pointer;
width: 14px !important;
height: 14px !important;
border-radius: 50%;
text-align: center;
position: relative;
z-index: 1;
border: none;
padding: 6px;
background: #2d6e84;
font-size: 14px;
margin-bottom: 7px;
}
.featured-images .user-info ul li [class^="fw-icon-"]:hover {
text-decoration: none;
background: #fff;
color: #2d6e84;
}
<div class="featured-images">
<div class="container">
<h1>OUR TEAM</h1>
<h2>MEET OUR TEAM</h2>
<div class="hh-divider"></div>
<div class="row-fluid">
<ul class="grid effect-3" id="grid">
<!--##############################################################TEAM MEMBERS#########################################################################-->
<li class="span2">
<div class="user-info">
<div class="aligncenter">
<img src="img/sam.jpeg" alt="">
<h1>name1 </h1>
<p class="last">Co-president </br> MBA 2018 </p>
<ul>
<li><a href="#"><i class="fw-icon-facebook"></a></i>
</li>
<li><a href="#"><i class="fw-icon-twitter"></a></i>
</li>
</ul>
</div>
</li>
<li class="span2">
<div class="user-info">
<div class="aligncenter">
<img src="img/sam.jpeg" alt="">
<h1>name2 </h1>
<p class="last">Co-president </br> MBA 2018 </p>
<ul>
<li><a href="#"><i class="fw-icon-facebook"></a></i>
</li>
<li><a href="#"><i class="fw-icon-twitter"></a></i>
</li>
</ul>
</div>
</li>
<li class="span2">
<div class="user-info">
<div class="aligncenter">
<img src="img/sam.jpeg" alt="">
<h1>name3 </h1>
<p class="last">Co-president </br> MBA 2018 </p>
<ul>
<li><a href="#"><i class="fw-icon-facebook"></a></i>
</li>
<li><a href="#"><i class="fw-icon-twitter"></a></i>
</li>
</ul>
</div>
</li>
【问题讨论】:
-
CSS 不是很好,HTML cmets 中过多的
#是怎么回事? -
@cybermonkey 似乎 cmets 使
.html文件看起来更有条理。 -
@lejanp 对我来说看起来不错。您只需要从
ul和可能的li元素中删除填充。 -
@ChrisHappy 是的,但确实不需要过多的
#,尤其是在 Stack Overflow 上寻求帮助时。 -
对不起那些家伙