【问题标题】:Bootstrap Column 6 Image Issue引导列 6 图像问题
【发布时间】:2016-01-28 23:49:16
【问题描述】:

现在,这是一个新项目,所以我需要一些帮助。

我有以下代码。请按全屏。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<!DOCTYPE html>
	<head>
		<title>Stack Overflow Question</title>
		<link rel="stylesheet" type="text/css" href="bootstrap.css">
		<link rel="stylesheet" type="text/css" href="style/home.css">
		<!-- Reference to main CSS Style File-->
		<style>

		
		ul {
			margin:0 auto;
			border-top:2px solid #000;
			border-bottom: 2px solid #000;
			padding:10px;
			text-align: center;
			font-family:"montserratlight";
			text-transform: uppercase;
		}
		
		</style>
	</head>
	<body>
		<div class="container">

			<div id = "navigation">
				<p>
					<ul class="col-md-12"> 
						<!-- MAIN NENU BAR -->
						<li><a href="home.html" class="active"><b>Home</b></a></li>
						<li><a href="about.html">Why Does This</a></li>
						<li><a href="products.html">Not</a></li>
						<li><a href="contactUs.html">Work</a></li>
					</ul>
					<!-- Unordered lists.-->
				</p>
			</div>
			
			<div class = "row">
			<!-- Declaration of First Row -->
				<div class="imageHolder col-md-12 hvr-underline-from-center"> 
				<!-- Image Container as DIV -->
					<div class = "imageInside" >
						<img id = "imageHomeJPG" src="http://s30.postimg.org/8wav359r5/NYC.jpg" style="width:100%" />
					</div>
					<!-- Image Link -->
    			</div>	
			</div>
			
			<div class="row">
				<div class="col-md-6">
						<a href="about.html">
						<img src = "http://s30.postimg.org/mehrfflwh/Place1.jpg" style="margin-bottom:10px; margin-top:10px; width:100%;"/>
						</a>
				</div>
				<div class="col-md-6">
						<a href="about.html">
						<img src = "http://s30.postimg.org/iw5rj1l0h/Place2.jpg" style="margin-bottom:10px; margin-top:10px; width:100%;"/>
						</a>
				</div>
			</div>
	</body>
	</html>

现在,当展开时,这就是网站显示的内容。

但是,第 6 列的两张照片之间存在小的差距。


<div class="row" style="padding-right:0">
    <div class="col-md-6">
        IMAGE TAG 
    </div>
    <div class="col-md-6" style="padding-left:0">
        IMAGE TAG
</div>

这产生了以下 -

您可以看到左边的图像在右边更大,因此它不正确。 我的问题是,我怎样才能使两列之间的间隙更小(大约 10 像素)而不需要更改填充?我想将图像放大以减小间隙的大小,但我似乎找不到方法!

谢谢。

【问题讨论】:

    标签: html css twitter-bootstrap margin padding


    【解决方案1】:

    要真正解决这个问题,我还可以转到 Bootstrap CSS 文件并将 padding-leftpadding-right 值编辑为相等的数量。

    最初,这两个值都设置在

    padding-left:15px;
    padding-right:15px;
    

    但看看其他示例,例如 airBnb,它们的填充都设置为 12.5,所以这也是另一种解决方案。

    【讨论】:

      【解决方案2】:

      创建一个类:

      no-space { 
             Width: 100% !important;
             Margin: 0px !important;
      }
      

      然后将这个类放在 col-md-6 被这样的空间渗透评级的旁边:

      Class="col-md-6 no-space"
      

      现在照片之间应该没有空格了。

      【讨论】:

      • 如果我希望空间为 10px 宽怎么办?
      • 然后把边距设置为5px或宽度设置为95%
      猜你喜欢
      • 2016-06-11
      • 2021-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-09
      • 2013-08-03
      • 1970-01-01
      相关资源
      最近更新 更多