当获得col-xs-12模式时,我需要它们在中心

时间:2016-11-03 08:23:35

标签: html css twitter-bootstrap css3 twitter-bootstrap-3

.secondRow{
	margin-top: 25px;
}


.iconBigger{
	font-size: 26px;
	color: grey;
}

.letterSmall{
	font-size: 10px;
	padding-top: 5px;
}

.getPadding{
	padding-left: 10px;
	cursor: pointer;

}

.getPadding:hover{
	color: #E71D35;
	transition-duration: 250ms;
}

.getPadding:hover .iconBigger{
	color: #E71D35;
	transition-duration: 250ms;
}

@media screen and (max-width: 768px) {
    .aas {
        float: left;
    }
}
<div class="row secondRow center-block">
			<div class="col-xs-12 col-sm-4 col-lg-3">
				<div class="information ac ib getPadding">
					<span class="glyphicon glyphicon-menu-hamburger iconBigger" aria-hidden="true"></span>
					<p class="letterSmall">ՏԵՂԵԿԱՏՎՈՒԹՅՈՒՆ</p>
				</div>
				<div class="contactUs ac ib getPadding">
					<span class="glyphicon glyphicon-envelope iconBigger" aria-hidden="true"></span>
					<p class="letterSmall">CONTACT US</p>
				</div>
			</div>
			<div class="col-xs-12 col-sm-2 col-sm-offset-0 col-lg-3 col-lg-offset-2">
				<div class="logoHolder">
					<img src="images/logo.png" alt="">
				</div>
			</div>
			<div class="col-xs-12 col-sm-4 col-sm-offset-1 col-lg-3 col-lg-offset-1">
				<div class="fr aas">
					<div class="information ac ib getPadding">
						<span class="glyphicon glyphicon-menu-hamburger iconBigger" aria-hidden="true"></span>
						<p class="letterSmall">ՏԵՂԵԿԱՏՎՈՒԹՅՈՒՆ</p>
					</div>
					<div class="contactUs ac ib getPadding">
						<span class="glyphicon glyphicon-envelope iconBigger" aria-hidden="true"></span>
						<p class="letterSmall">CONTACT US</p>
					</div>
				</div>
			</div>
		</div>

伙计们,请帮助我。当它已经处于xs-12模式时,一切都浮动到左边,但我需要它们全部处于xs-12模式和中心。我怎样才能让他们在中心?我试图通过不同的方式让他们居中,但不幸的是我无法。

1 个答案:

答案 0 :(得分:0)

margin:0 autodisplay:table添加到您必须位于中心的元素。我认为这是您想要的解决方案。

.secondRow{
  margin:0 auto;
  display:table;
}


.iconBigger{
	font-size: 26px;
	color: grey;
}

.letterSmall{
	font-size: 10px;
	padding-top: 5px;
}

.getPadding{
	padding-left: 10px;
	cursor: pointer;

}

.getPadding:hover{
	color: #E71D35;
	transition-duration: 250ms;
}

.getPadding:hover .iconBigger{
	color: #E71D35;
	transition-duration: 250ms;
}

@media screen and (max-width: 768px) {
    .aas {
        float: left;
  
<div class="row secondRow center-block">
			<div class="col-xs-12 col-sm-4 col-lg-3">
				<div class="information ac ib getPadding">
					<span class="glyphicon glyphicon-menu-hamburger iconBigger" aria-hidden="true"></span>
					<p class="letterSmall">ՏԵՂԵԿԱՏՎՈՒԹՅՈՒՆ</p>
				</div>
				<div class="contactUs ac ib getPadding">
					<span class="glyphicon glyphicon-envelope iconBigger" aria-hidden="true"></span>
					<p class="letterSmall">CONTACT US</p>
				</div>
			</div>
			<div class="col-xs-12 col-sm-2 col-sm-offset-0 col-lg-3 col-lg-offset-2">
				<div class="logoHolder">
					<img src="images/logo.png" alt="">
				</div>
			</div>
			<div class="col-xs-12 col-sm-4 col-sm-offset-1 col-lg-3 col-lg-offset-1">
				<div class="fr aas">
					<div class="information ac ib getPadding">
						<span class="glyphicon glyphicon-menu-hamburger iconBigger" aria-hidden="true"></span>
						<p class="letterSmall">ՏԵՂԵԿԱՏՎՈՒԹՅՈՒՆ</p>
					</div>
					<div class="contactUs ac ib getPadding">
						<span class="glyphicon glyphicon-envelope iconBigger" aria-hidden="true"></span>
						<p class="letterSmall">CONTACT US</p>
					</div>
				</div>
			</div>
		</div>