twitter-bootstrap 面板内的 Twitter Bootstrap 网格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19990733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Twitter Bootstrap grid inside a panel
提问by user2994267
I am trying to use the grid system of Bootstrap to accomplish having an image to the left side while being able to have content (text & other bootstrap components) filling the space to the right. The only problem I have with this is that I cannot get the text to go where I want it to.
我正在尝试使用 Bootstrap 的网格系统来完成左侧的图像,同时能够让内容(文本和其他引导程序组件)填充右侧的空间。我遇到的唯一问题是我无法让文本去我想要的地方。
The text "STUFF" represents the content. I would like the content to be put to the right of the image & not below (the boxed area shown below). I tried using a grid system to accomplish this but I am either doing it incorrectly or I cannot use this method.
文本“STUFF”代表内容。我希望将内容放在图像的右侧而不是下方(如下所示的方框区域)。我尝试使用网格系统来完成此操作,但我要么做错了,要么无法使用此方法。


I am using Twitter Bootstrap version 3.0.2. My HTML code is present below (excuse the inefficient code, I was using this to play around) & I am using the Bootstrap .css & .js files, with some minor edits that do not pertain to my problem.
我正在使用 Twitter Bootstrap 3.0.2 版。我的 HTML 代码出现在下面(请原谅效率低下的代码,我正在使用它来玩)&我正在使用 Bootstrap .css 和 .js 文件,并进行了一些与我的问题无关的小编辑。
Additional information: I am using 2 HTML pages (how absurd, right?), 1 (the lighter area) within the other (the main page/the darker/outer area). The HTML code I provide is the code to the inner page.
附加信息:我正在使用 2 个 HTML 页面(多么荒谬,对吧?),另一个(主页/较暗/外部区域)内的 1 个(较亮区域)。我提供的 HTML 代码是内页的代码。
Also, I would like to know how to have a 'horizontal' <hr>between the image and the content.
另外,我想知道如何<hr>在图像和内容之间设置“水平” 。
<!DOCTYPE html>
<html>
<head>
<title>TITLE</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../../assets/css/bootstrap.css" rel="stylesheet">
</head>
<body style="background-color: #F0F0F0; padding-top: 15px">
<div class="panel panel-default" style="margin-left: 15px; margin-right: 15px">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<img src="http://placehold.it/140x140" class="img-rounded" style="width: 100px; height: 100px">
</div>
<div class="col-md-10">
STUFF
</div>
</div>
</div>
</div>
<hr>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="../../assets/js/bootstrap.js"></script>
</body>
</html>
回答by Zim
Try this..
试试这个..
<div class="panel panel-default" style="margin-left: 15px; margin-right: 15px">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<img src="http://placehold.it/140x140" class="img-rounded" style="width: 100px; height: 100px">
</div>
<div class="col-md-10">
STUFF
</div>
</div>
</div>
</div>
<hr>
<div class="panel panel-default" style="margin-left: 15px; margin-right: 15px">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-2">
<img src="http://placehold.it/140x140" class="img-rounded" style="width: 100px; height: 100px">
</div>
<div class="col-xs-10">
STUFF
</div>
</div>
</div>
</div>

