引导脚手架 [英] Bootstrap Scaffolding

查看:58
本文介绍了引导脚手架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我目前正在尝试找出如何在使用Bootstrap时使两个类并排浮动,我希望完成的工作是使我的文字向左浮动,图像向右浮动!这是我的代码:

Hello I am currently trying to figure out how to get two classes to float side by side while using Bootstrap, What I wish to accomplish is to get my text to float to the left and image float to the right! Here is my code:

 <div class="row-fluid">
  <div id="test-1" class="span6"></div>
  <div id="test-2" class="span6"></div>
</div>

body {
  background-color: black;
}
#test-1 {
  background-color: white;
  height: 200px;
  width: 200px;
}
#test-2 {
  background-image: url("http://www.rd.com/wp-content/uploads/sites/2/2016/04/01-cat-wants-to-tell-you-laptop.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  height: 200px;
  width: 200px;
}

推荐答案

您可以同时使用 pull-left & pull-right col-xs-6 ,具体取决于您要实现的目标.

You can use both pull-left & pull-right or col-xs-6, depending upon what exactly you want to achieve.

下面是jsfiddle链接后面的代码,显示了已完成的两件事:

Here's the code followed by jsfiddle link showing both things done:

    body {
      background-color: black;
    }
    #test-1 {
      background-color: white;
      height: 200px;
      width: 200px;
    }
    #test-2 {
      background-image: url("http://www.rd.com/wp-content/uploads/sites/2/2016/04/01-cat-wants-to-tell-you-laptop.jpg");
      background-size: cover;
      background-repeat: no-repeat;
      height: 200px;
      width: 200px;
    }

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

    <div class="row-fluid">
          <div id="test-1" class="span6 pull-left"></div>
          <div id="test-2" class="span6 pull-right"></div>
        </div>
        
        <div class="clearfix"></div>
        
        <div class="row-fluid">
          <div id="test-1" class="span6 col-xs-6"></div>
          <div id="test-2" class="span6 col-xs-6"></div>
        </div>

Jsfiddle链接: https://jsfiddle.net/jLfcpssz/

Jsfiddle link: https://jsfiddle.net/jLfcpssz/

这篇关于引导脚手架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆