【发布时间】:2016-04-30 00:58:54
【问题描述】:
我希望在“.service-icon”位于每列中心的部分中有 3 个响应列。我有一个列背景的图像(dirtcolumn.png,但这可以用一个全高的 div 代替……我想要的只是它在 div/column 内居中)。你可以在我的第一个网站在封面下的第一部分看到问题出现在哪里----> MOST RECENT SCREENSHOT - http://aleven.netne.net/CDH/
HTML:(在安排了我可能想到的每个标记之后,其中包括给所有 div 类 col-md-4 col-xs-4 ETC.ETC。)
<section id="services">
<div class="container-fluid">
<div class="row">
<div class="columndirt col-md-4 text-center">
<div class="service-icon">
<div class="icon-daycare">
</div>
</div>
</div>
<div class="columndirt col-md-4 text-center">
<div class="service-icon">
<div class="icon-daycare">
</div>
</div>
</div>
<div class="columndirt col-md-4 text-center">
<div class="service-icon">
<div class="icon-daycare">
</div>
</div>
</div>
</div>
</div>
</section>
CSS:
#services {
background-color: #291501;
/*background-image: url(../images/cdh/newheader/ps/dirtcolumns.png);*/
padding: 0px 0;
padding-bottom: 0px;
background-size: 100% 100%;
background-repeat: no-repeat;
text-align: center center;
position: relative;
min-height: 590px;
display: block;
vertical-align: middle;
position: relative;
}
.columndirt {
float: none;
margin: 0 auto;
background-image: url(../images/cdh/newheader/ps/dirtcolumn.png);
background-size: cover;
background-repeat: no-repeat;
background-size: 70% 100%;
top:0;
bottom:0;
max-height: auto;
max-width: 37%;
min-width: 37%;
background-position: center center;
text-align: center center;
vertical-align: middle;
position: absolute;
}
.service-icon {
float: none;
margin: 0 auto;
margin: 158px;
margin-top: 180px;
border-radius: 100%;
background-color: #6d4827;
background-image: url(../images/cdh/newheader/ps/dots.png);
background-size: 1500px;
display: inline-block;
font-size: 36px;
height: 170px;
line-height: 170px;
width: 170px;
-webkit-transition: background-color 0.2s ease;
transition: background-color 0.2s ease;
vertical-align: middle;
}
.icon-daycare {
vertical-align: middle;
color: #9f6c43;
display: inline-block;
max-width: 100%;
min-height: 50%;
min-width: 100%;
background-image: url(../images/cdh/newheader/ps/daycareicon.png);
background-position: center center;
background-size: contain;
background-repeat: no-repeat;
}
}
【问题讨论】:
-
我在您提供的链接中没有发现任何问题。你能解释一下你的屏幕截图问题吗?
-
@MeFaysal 我已经更新了屏幕截图。我希望污垢列在服务图标后面居中。出于某种原因,只有一个会出现或什么都不会出现....我想要所有 3 个。
-
您是否在与您的
col-md-4相同的 div 上尝试过 Bootstrap 的text-center类?它将所有内容集中在 div 内。 -
你想要这样的东西吗? imgur.com/CXuMZBi
-
@MeFaysal 关闭。我想在圆圈内再添加一个 div/图像。类似于我示例中的温室图标。我希望白框是父/节的全高。
标签: css html twitter-bootstrap responsive