【问题标题】:Bootstrap heading wrapping issue引导标题换行问题
【发布时间】:2016-05-13 17:25:56
【问题描述】:

]2

在大网格中的引导程序中,当“social recr..”标题需要换行时,它会给品牌标识列带来对齐问题,因为它的标题不够长,无法正确对齐。 如何解决引导问题

代码:

<br/>
                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
                    <h3>Social Recruitment Campaigns</h3>
                    <img src="whatweCreate-SocialCampaign.png" class="img-responsive">
                </div>
                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
                    <h3>Brand Identity</h3>
                    <img src="whatweCreate-BrandID.png" class="img-responsive">
                </div>
                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
                    <h3>Responsive Career Websites</h3>
                    <img src="whatweCreate-responsive.png" class="img-responsive">
                </div>
                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
                    <h3>Career Videos</h3>
                    <img src="whatweCreate-CareerVideo.png" class="img-responsive">
                </div>
                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
                    <h3>Digital Marketing</h3>
                    <img src="whatweCreate-digitalMarketing.png" class="img-responsive">
                </div>
                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
                    <h3>Games</h3>
                    <img src="whatweCreat-gamese.png" class="img-responsive">
                </div>

【问题讨论】:

    标签: twitter-bootstrap alignment


    【解决方案1】:
    1. 在 col-md-4 div 中插入所有标题。
    2. 用 col-md-12 div 包装它们
    3. 对您的图像执行相同的操作。

    所有图像现在都处于相同的垂直对齐状态

    <div class="col-md-12">
    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <h3>Social Recruitment Campaigns</h3>  </div> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <h3>Brand Identity</h3> </div> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <h3>Responsive Career Websites</h3> </div></div> 
    
    <div class="col-md-12">
    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <img src="whatweCreate-SocialCampaign.png" class="img-responsive"> </div> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <img src="whatweCreate-BrandID.png" class="img-responsive"> </div> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <img src="whatweCreate-responsive.png" class="img-responsive"> </div></div>
    

    【讨论】:

    • 很抱歉,我无法告诉您要进行哪些更改,请您出示一下。
    • 我将它添加到我的答案中。我希望你明白我的想法。不能摆弄它我不在电脑上
    • 谢谢它解决了这个问题,但现在在小屏幕上,所有标题都在一个下方,图像一个在另一个下方,而不是交替
    • 将 col-lg-12 和 col-sm-12 添加到外部的 div 中,或者它在移动设备中的外观如何?
    【解决方案2】:

    你可以试试这个:

    <h3><br>Brand Identity</h3>
    

    不是最好的解决方案,但它很容易并且应该可以工作。

    【讨论】:

    • 如果我这样做,那么当一切都适合大屏幕时,只有品牌标识图像会被推下
    • 好吧,您可以简单地将
      隐藏在导致该问题的屏幕尺寸上。
    【解决方案3】:

    使用 BootStrap 执行此操作的正确和最可取的方法是为标题和相应的图像分别创建行。

    保持单独的第一行包含标题,然后是包含相同数量图像的行。

    优点:
    通过这种方式,您还将减少为您的应用程序创建错误网格结构的机会。另一个优点是,由于标题和图像被描绘出来,因此对任何单个元素进行任何更改所花费的精力都是最小的,因为它非常模块化。

    <div class="row">
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"><h3>Social Recruitment Campaigns</h3></div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"><h3>Brand Identity</h3></div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"><h3>Responsive Career Websites</h3></div>
    </div>
    <div class="row">
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
        <img src="whatweCreate-responsive.png" class="img-responsive">
      </div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
        <img src="whatweCreate-responsive.png" class="img-responsive">
      </div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
        <img src="whatweCreate-responsive.png" class="img-responsive">
      </div>
     </div>
    <div class="row">
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"><h3>Career Videos</h3></div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"><h3>Digital Marketing</h3></div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"><h3>Games</h3></div>
    </div>
    <div class="row">
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
        <img src="whatweCreate-responsive.png" class="img-responsive">
      </div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
        <img src="whatweCreate-responsive.png" class="img-responsive">
      </div>
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
        <img src="whatweCreate-responsive.png" class="img-responsive">
      </div>
    </div>
    

    这里是Fiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-01
      • 1970-01-01
      相关资源
      最近更新 更多