我是twitter bootstrap的新手,试图用它构建我的第一个网站。我有一个很好的模板。我遇到了一个问题,即我不知道如何在不应用CSS的情况下解决问题。我想知道它是否可以在没有css帮助的情况下解决。
我有一个12列网格。我放了3张图片,占据了4列。我最终在这三个图像之间找到了一个漂亮的排水沟。我在前三名下方添加了三张图片,最后他们之间也有一个漂亮的排水沟。问题是图像上没有排水沟。因此,顶部列中的图像触摸底部列中的图像。
你如何在上面找到漂亮的排水沟?
我想如果我把底部的3张图片放到一个可以解决它的新行中,但它没有。
这是我的代码
<div class="row">
<h2>Featured Projects</h2>
<div class="col-lg-4">
<img src="images/puters.png" class="img-responsive" height="189" width="327" alt="computers">
</div>
<div class="col-lg-4">
<img src="images/teacher.png" class="img-responsive" height="189" width="327" alt="teacher">
</div>
<div class="col-lg-4">
<img src="images/student.png" class="img-responsive" height="189" width="327" alt="students">
</div>
<div class="col-lg-4">
<img src="images/test.png" class="img-responsive" height="189" width="327" alt="students">
</div>
<div class="col-lg-4">
<img src="images/puters.png" class="img-responsive" height="189" width="327" alt="computers">
</div>
<div class="col-lg-4">
<img src="images/teacher.png" class="img-responsive" height="189" width="327" alt="teacher">
</div>
</div><!--END row-->
答案 0 :(得分:2)
杰米你好。
您可以这样做...将类添加到包含第二组图像的row
这样你只需要为每个第二行图像添加一个类而不是一个类
我知道你不想使用任何CSS,但这适用于你想做的事情
希望这可以帮助。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Starter Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style>
body {
padding-top: 50px;
}
.spacer {
margin-top: 2%;
margin-bottom: 2%;
}
.clear-top {
margin-top: 25px;
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top ">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand " href="#">Project name</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container col-lg-12 spacer"></div>
<div class="container col-lg-12">
<div class="row">
<h2>Featured Projects</h2>
<div class="col-xs-4">
<img src="http://lorempixel.com/640/640/nature" class="img-responsive" alt="computers">
</div>
<div class="col-xs-4">
<img src="http://lorempixel.com/640/640/nature" class="img-responsive" alt="teacher">
</div>
<div class="col-xs-4">
<img src="http://lorempixel.com/640/640/nature" class="img-responsive" alt="students">
</div>
</div><!--END row-->
<div class="row clear-top">
<div class="col-xs-4">
<img src="http://lorempixel.com/640/640/nature" class="img-responsive" alt="students">
</div>
<div class="col-xs-4">
<img src="http://lorempixel.com/640/640/nature" class="img-responsive" alt="computers">
</div>
<div class="col-xs-4">
<img src="http://lorempixel.com/640/640/nature" class="img-responsive" alt="teacher">
</div>
</div><!--END row-->
</div><!-- /.container -->
<!-- Bootstrap core JavaScript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
&#13;