【问题标题】:Bootstrap with five images with same row具有相同行的五个图像的引导程序
【发布时间】:2023-03-24 21:48:01
【问题描述】:

我期待像这张图片Link

图片中有 5 张图片和虚线图片的链接..

请问,如何使用引导类进行显示。

我很困惑,谁能帮我解决这个问题?

谢谢,

下面是使用table标签的代码:

<td class="tdbodycontent" id="workDemo">
                <div class="wrapper" style="height:340px;">
                    <table class="tblhomecontent dotted" cellpadding="0" cellspacing="0">
                        <tbody><tr>
                            <td colspan="5">
                                <div class="boxtitle">
                                    How it works</div>
                            </td>
                        </tr>
                        <tr>
                            <td class="box5col">
                                <div class="marker_1 center">
                                </div>
                                <p class="markerContent">
                                    Sign Up for free</p>
                            </td>
                            <td class="box5col">
                                <div class="marker_2 center">
                                </div>
                                <p class="markerContent">
                                    Select the<br>
                                    neighborhoods<br>
                                    you want to follow</p>
                            </td>
                            <td class="box5col">
                                <div class="marker_3 center">
                                </div>
                                <p class="markerContent">
                                    Invite friends and<br>
                                    family to join</p>
                            </td>
                            <td class="box5col">
                                <div class="marker_4 center">
                                </div>
                                <p class="markerContent">
                                    Receive important<br>
                                    alerts and information<br>
                                    from trusted sources</p>
                            </td>
                            <td class="box5col">
                                <div class="marker_5 center">
                                </div>
                                <p class="markerContent">
                                    Share information<br>
                                    with friends<br>
                                    securely</p>
                            </td>
                        </tr>
                    </tbody></table>
                </div>
            </td>

我需要在引导中进行转换,这是图片链接dottedstep-1step-2step-3step-4step-5

【问题讨论】:

  • 那么你尝试了什么?
  • 我正在使用 div 类容器,我在引导程序中引用了列。它限制为 12 列,在我的页面中有 5 个部分。所以我很困惑,如何开始..

标签: html css twitter-bootstrap


【解决方案1】:

这可能对你有用。 或者您需要编写自定义媒体 css 样式来实现此目的。

<div class="row">
    <div class="col-md-2 col-md-offset-1"><img src="images/sample.jpg"></div>
    <div class="col-md-2"><img src="images/sample.jpg"></div>
    <div class="col-md-2"><img src="images/sample.jpg"></div>
    <div class="col-md-2"><img src="images/sample.jpg"></div>
    <div class="col-md-2"><img src="images/sample.jpg"></div>
</div>

【讨论】:

  • 我可以知道如何连接虚线图像..吗?谢谢
【解决方案2】:

anu g prem的解决方案的基础上,为虚线添加一些东西,加上一些解释。

Live example

<div class="container">
  <div class="row steps">
    <hr class="col-xs-8 col-xs-offset-2" />

    <div class="col-xs-2 col-xs-offset-1"><img src="http://s22.postimg.org/pq17qfgwd/step_1.png" class="img-responsive"></div>
    <div class="col-xs-2"><img src="http://s22.postimg.org/5u58avzv1/step_2.png" class="img-responsive"></div>
    <div class="col-xs-2"><img src="http://s22.postimg.org/58g9es4st/step_3.png" class="img-responsive"></div>
    <div class="col-xs-2"><img src="http://s22.postimg.org/576bld2z1/step_4.png" class="img-responsive"></div>
    <div class="col-xs-2"><img src="http://s22.postimg.org/g9bejsx1p/step_5.png" class="img-responsive"></div>

  </div>
</div>
.steps {
    position: relative;
}

.steps hr {
    /* Use the 3 lines below to use a dotted line image file as background of the <hr> */
    border: none;
    background: transparent url('http://s22.postimg.org/53ci53xht/dotted.png') no-repeat center center;
    height: 2px;
    /* Use the line below instead to style the <hr> with a border */
    /*border-top: 1px dashed gray;*/

    margin-top: 0;
    margin-bottom: 0;
    position: absolute;
    top: 50%;
}

.steps .img-responsive {
    margin: 0 auto;
}

您会注意到我没有使用您的虚线,而是使用了&lt;hr&gt;,并用虚线设置了border-top 的样式。 (编辑:但 op 想要使用他提供的图像,请参阅 cmets。)

要回答有关列数的问题(10 与 Bootstrap 网格的 12),您需要了解您并不总是必须填写所有 12 列。在这里,我们为每个图像使用 2 列,加上第一列作为偏移量,您将获得五张图像,居中,左侧有一个偏移量列,右侧有一个空列,这很好!

请注意,我使用img-responsive 类来确保您的图像在它们的 2 列之外不会变得太大,并且我在 col-xs-2 类中使用了xs(意思是“超小”),这意味着所有设备屏幕尺寸将使五个图像在同一行上(并调整大小以适应),这对于较小的设备可能不想要...

【讨论】:

  • 您能否解释一下为什么您需要使用虚线图像?您是否至少允许对其进行编辑以使其更可用(删除左侧的空白区域,以防止图像被重复作为背景)。你检查我的live example了吗?这条线与您的图像非常相似,我相信通过更多的工作,您可以将粗细和颜色调整为完全相同。
  • 没有任何理由..我只需要使用点状图像,它是通过引导程序链接到这5个图像的..谢谢
  • @saina 你必须提供更多细节,因为这对我来说真的没有意义......无论如何,我用一个允许你使用点的解决方案编辑了我上面的帖子行图像文件,而不是纯 CSS 边框样式。怎么样?
  • @saina 不,这完全是另一个问题,我们不应该在这里讨论。你应该发布另一个问题来问它,拜托。顺便说一句,如果您认为我上面提供的解决方案可以解决您的问题,那么接受它真的很好。
  • 当我调整窗口大小时,响应式视图不起作用。
猜你喜欢
  • 2017-01-09
  • 2018-10-30
  • 2015-06-09
  • 2023-03-09
  • 2015-03-23
  • 2016-04-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多