简体   繁体   English

带有文本和图像的 Bootstrap 3 面板(图像具有不同的背景)

[英]Bootstrap 3 panels with text and images (with different background for the images)

I am trying to implement 3 panels with text and images with a different background color for the images (darker) and another color for the text.我正在尝试实现 3 个带有文本和图像的面板,图像的背景颜色不同(较暗),文本的背景颜色不同。

this is my current code which works for the desktop version of the website but breaks on mobile.这是我当前的代码,适用于网站的桌面版本,但在移动设备上中断。 At the moment the layout is IMAGE->IMAGE->IMAGE.目前布局是IMAGE->IMAGE->IMAGE。 Text->Text->Text and it should be IMAGE -> Text. Text->Text->Text 应该是 IMAGE -> Text。 Image -> Text.图像 -> 文本。 Image -> Text:图像 -> 文本:

current code当前代码

So as per my comment, you need to include both your image and text into a column, then all three columns into a row.因此,根据我的评论,您需要将图像和文本都包含在一列中,然后将所有三列都包含在一行中。 Something like this:像这样的东西:

<div class="row">
  <div class="col-md-4">
    <div><img src="#"></div>
    <div>Some text</div>
  </div>
  <div class="col-md-4">
    <div><img src="#"></div>
    <div>Some text</div>
  </div>
  <div class="col-md-4">
    <div><img src="#"></div>
    <div>Some text</div>
  </div>
</div>

You should check out the bootstrap site for guidance on using their grid layout :)您应该查看引导站点以获取有关使用其网格布局的指导:)

In bootstarp to using panels you must use panel codes you can see the bootstrap panels here Bootstrap Panels在使用面板的引导程序中,您必须使用面板代码,您可以在此处看到引导程序面板Bootstrap Panels

<div class="row">
    <div class="container">
        <div class="panel panel-default">
            <div class="panel-heading">Panel heading without title</div>
            <div class="panel-body">
                <img src="#">
                <p>text Here</p>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">Panel heading without title</div>
            <div class="panel-body">
                <img src="#">
                <p>text Here</p>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">Panel heading without title</div>
            <div class="panel-body">
                <img src="#">
                <p>text Here</p>
            </div>
        </div>
    </div>
</div>

Automatically all three columns put in the one row if you want use different column grid you must the another div tag to specify the grids如果您想使用不同的列网格,则自动将所有三列放在一行中,您必须使用另一个 div 标签来指定网格

also panels have the panel title class but I used panel heading class you can use panel title if you want面板也有面板标题类,但我使用了面板标题类,如果需要,您可以使用面板标题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM