【问题标题】:Content Positioning trick on bootstrap引导程序上的内容定位技巧
【发布时间】:2015-10-12 04:25:41
【问题描述】:

请先检查此 HTML 模板Clippinghand

我的问题在于我们在下面提供的内容。有第一个图像,然后是帖子,下一个是第一个帖子,然后是我拍摄的 6 Element 图像。在计算机类型的设备上,一切都还好,但是当我要让它对移动或标签设备做出响应时,它会出现问题,问题是图像和内容越来越接近我只是总是想让它们成为帖子的顶部我的意思是我想要我的图片都在帖子的顶部,我该怎么做?有什么诀窍吗?另外,我如何仅使用一个自定义帖子来完成此部分? Here is an example on image

【问题讨论】:

  • 实时站点还可以,但您不能真正工作并保存在那里。使用 Stack Overflow 提供的代码 sn-p 来解释问题。因此...我认为您的问题与页面中的 html 元素位置有关。如果您使用 Bootstrap 和默认列布局,则每列都向左浮动。使用 pull 和 push 类来反转较小设备的行中的顺序。这个问题已经在这里讨论过好几次了。

标签: css wordpress twitter-bootstrap wordpress-theming


【解决方案1】:

您可以通过 Bootstrap 内置的Push + Pull 使用列排序。您必须重新排序您的内容才能实现这一点。这里也不错article

基本上以相反的顺序堆叠列内容并应用推送和拉取类。 (*而不是内容 1,然后是内容 2,堆栈内容 2,然后是 col-md-6 中的内容 1)。查看工作示例,它将被说明。

.red {
  background: red;
}
.blue {
  background: lightblue;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<section id="our-services">
  <div class="container">
    <div class="row red">
      <div class="col-md-6">
        <div class="img-one">
          <img src="http://placehold.it/350x150" class="img-responsive" alt="">
        </div>
      </div>
      <div class="col-md-6">
        <div class="content-one">
          <h4>Background Remove</h4>
          <em>Price starts from $0.49</em>

          <p>This is the most demandable and most used image editing service all over the world for ecommerce product selling. Don’t worry, we make it easy to ensure all your images fit your ecommerce image editing guideline. We resize, crop, remove borders,
            and remove image background turning it to pure white, transparent or color background as per your guideline.</p>
        </div>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="row blue">
      <div class="col-md-6 col-md-push-6">
        <div class="img-two">
          <img src="http://placehold.it/350x150" class="img-responsive" alt="">
        </div>
      </div>
      <div class="col-md-6 col-md-pull-6">
        <div class="content-two">
          <h4>Web-ready Images</h4>
          <em>Price starts from $1</em>

          <p>For web-shop owners, we introduce our additional delivery of web-ready images. Add the image specifications (like crop size 800×800 px ) and we will deliver web-ready image. We can fulfill the image size requirements for any ecommerce platform
            like Amazon, eBay, Shopify, bigcommerce, volusion, squarespace etc.</p>
        </div>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="row red">
      <div class="col-md-6">
        <div class="img-three">
          <img src="http://placehold.it/350x150" class="img-responsive" alt="">
        </div>
      </div>
      <div class="col-md-6">
        <div class="content-three">
          <h4>Multiple Mask</h4>
          <em>Price starts from $2</em>

          <p>If you want to separate and modify different parts and features of the same product including its color, shape, and size, Multipath is the service you can take from us. We can deliver images with Alpha Channel, Layer Mask or Only Path.</p>
        </div>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="row blue">
      <div class="col-md-6 col-md-push-6">
        <div class="img-four">
          <img src="http://placehold.it/350x150" class="img-responsive" alt="">
        </div>
      </div>
      <div class="col-md-6 col-md-pull-6">
        <div class="content-four">
          <h4>COLOR MATCHING</h4>
          <em>Price starts from $2</em>

          <p>You have many different color variations of the same product but do not want to spend time taking photos of each one of them? No worries! You don’t have to. We can change the color and size of the same product as per your instruction to save
            you from investing more of your time and money in taking photos.</p>
        </div>
      </div>
    </div>
  </div>
</section>
<!-- End of Our services area -->

【讨论】:

  • 正是我一直在寻找的!它是内置的,我不知道..我只是想着就崩溃了。亲爱的,您节省了我很多时间。。在此之前,我使用显示块和无属性,将内容加倍。我知道这很糟糕,但我就是这样做的。不是它太容易制作了。
  • 它刚刚完美运行.. 再次感谢伙计。看看你会感到自豪..哈哈哈PushPull
【解决方案2】:

看这里:http://jsfiddle.net/mwvfteuq/

简而言之,您需要将divs 按您希望它们出现在最小屏幕上的顺序放置。对于更广泛的设备,您可以将float 设置为leftrightpull-leftpull-right 在引导程序中)来自定义元素的连续位置。使用最小屏幕的媒体查询撤销这些属性。

例如:

HTML(使用引导程序)

<div class="row">
    <div class="col-sm-6 pull-right right">img</div>
    <div class="col-sm-6">some stuff</div>
</div>
<div class="row">
    <div class="col-sm-6">img</div>
    <div class="col-sm-6">some stuff</div>
</div>

CSS

@media (max-width: 768px) {
    div.right{
        float:none !important;
    }
}

不要忘记使用!important 覆盖引导程序pull-right 属性

【讨论】:

  • 哇,谢谢!您的回答当然是有帮助和有用的。再次感谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-01-17
  • 1970-01-01
  • 2018-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-17
相关资源
最近更新 更多