我试图将主徽标下的3个图像平均分割并居中,但我有问题使图像与其他元素一起进入页面中间。
非常感谢任何理解这一点的帮助
网站为http://www.horizonarb.co.uk
<!DOCTYPE html>
Horizon Arboriculture
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Google Fonts -->
<script src="js/googleFonts.js" type="text/javascript"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans|Lobster+Two' rel='stylesheet' type='text/css'>
<!-- Custom CSS -->
<link href="css/custom.css" rel="stylesheet"></link>
<!-- Font Awesome -->
<link rel="stylesheet" href="css/fontawesome/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<div class="navbar navbar-default navbar-static-top" style="margin-bottom: 0px; margin-top: 10px;">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<small>MENU</small>
</button>
<a href=""><img src="img/front/HorizonArb_Tree_Transparent.png" class="noResize"></a>
</div> <!-- class="navbar-header" -->
<div class="collapse navbar-collapse">
<ul class="nav nav-pills navbar-right">
<li class="active"><a href="index.html">Home</a></li>
<!--
<li class="dropdown">
<a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Services <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="services.html">Crown Thinning</a></li>
<li><a href="#">Crown Lifting</a></li>
<li><a href="#">Crown Reduction</a></li>
</ul>
</li>-->
<li class=""><a href="services.html">Services</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div> <!-- class="collapse navbar-collapse" -->
</div> <!-- class="container" -->
</div> <!-- class="navbar navbar-default" -->
<div class="row">
<div class="col-md-6 col-sm-6 col-sm-offset-3 col-md-offset-3 center marginTopThirty">
<img src="img/front/HorizonArb_Transparent.png" width="50%">
</div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="col-md-4 col-sm-4 col-xs-4 marginTopThirty">
<img src="img/front/HorizonArb_Transparent.png" width="50%" class="img-responsive">
<p>Image 1</p>
</div>
<div class="col-md-4 col-sm-4 col-xs-4 marginTopThirty">
<img src="img/front/HorizonArb_Transparent.png" width="50%" class="img-responsive">
<p>Image 2</p>
</div>
<div class="col-md-4 col-sm-4 col-xs-4 marginTopThirty">
<img src="img/front/HorizonArb_Transparent.png" width="50%" class="img-responsive">
<p>Image 3</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 center marginTopThirty" id="topContainer">
<div class="col-md-10 col-sm-10 col-sm-offset-1 col-md-offset-1 center">
<p class="">Horizon Arboriculture is a professional Cheshire based tree surgery company with a small, expertly trained and qualified work force dedicated to providing high quality service and customer care. We are a Construction Health and Safety Scheme approved contractor (CHAS) that provide our services to both domestic and commercial clients.
NPTC和Lantra合格的员工。 1000万英镑的公共和雇主责任保险。免费,有竞争力,没有义务报价。
</div>
</div>
</div>
<div class="footer">
<div class="col-md-12 col-sm-12 center marginTopThirty" id="topContainer">
<small class ="center">Design by </small>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
答案 0 :(得分:1)
你可以(在你的CSS中):
设置图像&#39;利润率为&#34;汽车&#34; (保证金:自动)
或者:
将图像设置为&#34;显示:内联块&#34;和容器到&#34; text-align:center&#34;
两者都会将图像置于容器中心。
答案 1 :(得分:0)
您是否尝试将<div class="container">
放入<div class="row">
?
顺便说一句,你不必放<div class="col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-12">
做同样的事情
除非您想要<div class="col-lg-12 col-xs-6">
答案 2 :(得分:0)
听起来您已经成功设置了3列的行,但您只需将图像(以及下面的文字,我假设)置于其容器中心。
最简单的方法可能是将text-align: center
应用于您的div。由于图片和文字都已内联,因此我们不需要直接对其应用任何额外的样式。使用此属性将允许任何内联元素居中。
在这里进行测试,以及对Bootstrap结构的一些其他清理: https://jsfiddle.net/illogicaljake/m5t9smyt/