[Bootstrap] 5. Button and well

Element Identification

There are a number of classes in Bootstrap that help add prominence to a page by adding a background color and a rounded border like the below example.

Styling for this element is due to what Bootstrap class?

  • container
  • well
  • btn
  • lead

Choose a Well

Which of the following is NOT a Bootstrap class we could use to style well padding?

  • well
  • well-sm
  • well-md
  • well-lg

Button Element

It‘s a best practice to use a tags for all buttons, including Bootstrap‘s buttons, because browsers expect them to be clicked.

  • true
  • false

Button Color

Bootstrap has some very striking button colors that can be used by adding an additional class to any button. We really want the following button to stand out without conveying contextual information and have it styled appropriately.

The button class used to add color in this case is: btn-primary

Check out the following button element. It‘s a destructive action, and we‘ve given it a class to indicate that clicking on it will perform a potentially negative action. What Bootstrap class is being used to set its color?

The button class used to add this color is: btn-danger

Comparing Transport Systems

Like any main sales page, our site needs a good way for travelers to compare the features and prices between the different transport systems. The HTML for this was added, but the Bootstrap classes to make it look nice still need to be included. Follow the tasks to have the Transporter, Space Elevator, and RocketBus sections stand out.

<!DOCTYPE html>
<html>
  <head>
    <title>Blasting Off With Bootstrap</title>
    <link href=‘css/bootstrap.min.css‘ rel=‘stylesheet‘>
    <link href=‘css/main.css‘ rel=‘stylesheet‘>
  </head>
  <body>
    <div class=‘container‘>
      <div class=‘row‘>
        <div class=‘col-md-12‘>
          <h1>Blasting Off With Bootstrap</h1>
        </div>
      </div>

      <div class=‘row well well-lg‘>
        <div class=‘col-md-6‘>
          <h2>The Fastest Way to Space</h2>
          <p class=‘lead‘>Make your way to space in the comfort of your own rocket, elevator or transporter.</p>
          <button type=‘button‘ class=‘btn btn-lg btn-default‘>Take the Tour</button>
          <button type=‘button‘ class=‘btn btn-lg btn-primary‘>Book Tickets Now</button>
        </div>
        <div class=‘col-md-6 visible-md visible-lg‘>
          <img src=‘images/img-header.jpg‘ alt=‘Blast off with Bootstrap‘ />
        </div>
      </div>

      <div class=‘row text-center features‘>
        <div class=‘col-sm-4 col-xs-10 col-xs-offset-1 col-sm-offset-0‘>
          <i class=‘glyphicon glyphicon-briefcase‘></i>
          <h3>Book Today!</h3>
          <p>Even if you‘re traveling tomorrow, you can still get tickets today. We have a number of conveniently located ports around the globe to service everyone.</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-random‘></i>
          <h3>Go Anywhere</h3>
          <p>If you need to get to space today, why not try out a transporter? Despite the claims, there are have been no deaths in the last 6 weeks!</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-send‘></i>
          <h3>RocketBus&reg;</h3>
          <p>For cheapest fares, catch the next RocketBus&reg; to the stars. Cheaper on your wallet, and easiest way to make friends.</p>
        </div>
      </div>
    </div>
    <div class=‘quote‘>
      <div class=‘container‘>
        <blockquote>
          <p>Any sufficiently advanced technology is indistinguishable from magic.</p>
          <footer>Arthur C. Clarke in <cite title="Source Title">Profiles of the Future</cite></footer>
        </blockquote>
      </div>
    </div>

    <div class=‘container transport-systems‘>
      <div class=‘row‘>
        <div class=‘col-md-10 col-md-offset-1‘>
          <h2>Our Transport Systems</h2>
          <p>Learn more about our transport systems to find out which one is right for you. Pick out the mode of transport that works for your budget and risk level.</p>
        </div>
      </div>

      <div class=‘row‘>
        <div class=‘transporter col-md-3 col-md-offset-1‘>
          <h3>Transporter</h3>
          <ul>
            <li>8 second travel time</li>
            <li>Chance of death only 1 in 7,593</li>
            <li>Low price of only $15.99!</li>
          </ul>
          <p><button><i class=‘glyphicon glyphicon-transfer‘></i> Beam Me Up!</button></p>
        </div>
        <div class=‘space-elevator col-md-3 col-md-offset-1‘>
          <h3>Space Elevator</h3>
          <ul>
            <li>8 hour scenic ride</li>
            <li>Only 1 horrific death per 12,456</li>
            <li>Only $45.99 if you book today!</li>
          </ul>
          <p><button><i class=‘glyphicon glyphicon-sort‘></i> Board the Elevator!</button></p>
        </div>
        <div class=‘rocketbus col-md-3 col-md-offset-1‘>
          <h3>RocketBus</h3>
          <ul>
            <li>8 minute scenic ride</li>
            <li>Plunging death rate of under 1/100k</li>
            <li>$74.99 lets you blast off today!</li>
          </ul>
          <p><button><i class=‘glyphicon glyphicon-plane‘></i> Blast Off!</button></p>
        </div>
      </div>
    </div>

    <div class=‘footer‘>
      <div class=‘container‘>
        <div class=‘row‘>
          <div class=‘col-md-3 col-sm-4 col-xs-6‘>
            <h4>Who We Are</h4>
            <p><i>Blasting Off With Bootstrap</i> is the fastest way to space. <a href=‘tickets.html‘>Book your ticket today</a>!</p>
            <p><a href=‘about.html‘>More About Us <i class=‘glyphicon glyphicon-arrow-right‘></i></a></p>
          </div>

          <div class=‘col-md-offset-1 col-sm-2 col-xs-6‘>
            <h4>Links</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘/‘>Home</a></li>
              <li><a href=‘tickets.html‘>Tickets</a></li>
              <li><a href=‘stations.html‘>Stations</a></li>
            </ul>
          </div>

          <div class=‘clearfix visible-xs‘></div>

          <div class=‘col-sm-2 col-xs-6‘>
            <h4>Stay in Touch</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘about.html‘>About</a></li>
              <li><a href=‘contact.html‘>Contact Us</a></li>
              <li><a href=‘/blog‘>Blog</a></li>
              <li><a href=‘http://twitter.com/codeschool‘>Twitter</a></li>
              <li><a href=‘http://facebook.com/codeschool‘>Facebook</a></li>
            </ul>
          </div>

          <div class=‘col-md-3 col-md-offset-1 col-sm-4 col-xs-6‘>
            <h4>Contact Us</h4>
            <ul class=‘list-unstyled‘>
              <li><i class=‘glyphicon glyphicon-globe‘></i> Orlando, FL</li>
              <li><i class=‘glyphicon glyphicon-phone‘></i> 1-555-blast-off</li>
              <li><i class=‘glyphicon glyphicon-envelope‘></i> <a href=‘mailto:[email protected]‘>[email protected]</a></li>
            </ul>
            <p>Blasting Off With Bootstrap &copy;2214.</p>
          </div>
        </div>
      </div>
    </div>

    <script src=‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js‘></script>
    <script src=‘js/bootstrap.min.js‘></script>
  </body>
</html>

It doesn‘t make sense to left align our 3 transport systems. Center the text in all cells within that .row.

<div class=‘row text-center‘>
        <div class=‘transporter col-md-3 col-md-offset-1‘>
          <h3>Transporter</h3>
          <ul>
            <li>8 second travel time</li>
            <li>Chance of death only 1 in 7,593</li>
            <li>Low price of only $15.99!</li>
          </ul>
          <p><button><i class=‘glyphicon glyphicon-transfer‘></i> Beam Me Up!</button></p>
        </div>

Like the lists in our footer, we don‘t need bullet icons next to our lists here either. Remove them from each of the lists in the transport systems section.

<ul class="list-unstyled">

Each of the three transport systems could stand out a bit more. Add a class to eachdiv that would change the background color and add a rounded border to each. Within this area, include the title (like "Transporter") and the list of items.

        <div class=‘transporter col-md-3 col-md-offset-1 well‘>
          <h3>Transporter</h3>
          <ul class="list-unstyled">
            <li>8 second travel time</li>
            <li>Chance of death only 1 in 7,593</li>
            <li>Low price of only $15.99!</li>
          </ul>
          <p><button><i class=‘glyphicon glyphicon-transfer‘></i> Beam Me Up!</button></p>
        </div>

Our unstyled buttons are painful to look at. Add Bootstrap classes to the Transporterbutton to have it use the Bootstrap button styling. Also change the color to be similar to our footer link colors.

If you need a refresher on Bootstrap colors, checkout the Bootstrap Button Documentation.

<button class="btn btn-info"><i class=‘glyphicon glyphicon-transfer‘></i> Beam Me Up!</button>

-----------------

Links:http://getbootstrap.com/css/#buttons

时间: 2024-10-29 19:11:21

[Bootstrap] 5. Button and well的相关文章

Bootstrap的Button.js

查看Button.js的源代码 +function ($) { 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, Button.DEFAULTS, options) this.isLoadi

bootstrap的button按钮点击之后会有蓝色边框怎么解决?

.btn:focus,.btn:active:focus, .btn.active:focus,.btn.focus, .btn:active.focus,.btn.active.focus { outline: none; border-color: transparent; box-shadow:none; } 原文地址:https://www.cnblogs.com/sllzhj/p/8759200.html

[布局] bootstrap基本标签总结

文件头: DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>基础表格</title> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> </head> b

bootstrap基本标签总结[转]

文件头: DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>基础表格</title> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> </head> b

Bootstrap学习笔记01

1.Make Images Mobile Responsive 用处:   使图片适配你的页面宽度. 操作:   给图片添加 .img-responsive class属性. <img src="/images/cat.jpg" class="img-responsive"> 2.Center Text with Bootstrap 用处:   使文本居中. 操作:   给文本添加 center-text class属性. <p class=&qu

bootstrap框架的使用

bootstrap 1.首先要引入外部css文件在html中! 一共为4个 分别是: bootstrap.css bootstrap.min.css bootstrap-theme.css bootstrap-theme.min.css bootstrap框架和960框架是类似的! 首先来看如何在table里面加入框架样式: <able class="table"></table> table-striped 可以使奇数行的背景色设置为灰色! table-bor

Bootstrap之BootstrapDialog

Make use of Bootstrap's modal more monkey-friendly. http://nakupanda.github.io/bootstrap3-dialog/ Monkeys love the Modal Dialog from Bootstrap, but they're getting angry because they have to write this stuff: <div class="modal fade"> <d

Bootstrap 源码解析

Bootstrap 源码解析 1.Bootstrap的作用域 2.Bootstrap的类定义 3.Bootstrap的插件定义 4.Bootstrap的事件代理 5.Bootstrap的对象数据缓存 6.Bootstrap的防冲突 7.作用域外如何使用Button类 8.Bootstrap的单元测试 Bootstrap的作用域 Bootstrap每个插件都定义在下面这段作用域代码中: 请看<IIFE>和<严格模式>编译环境. 在插件的作用域之外,全局范围执行代码的第一行,检测了jQ

Bootstrap 源码解析(转)

1.Bootstrap的作用域 2.Bootstrap的类定义 3.Bootstrap的插件定义 4.Bootstrap的事件代理 5.Bootstrap的对象数据缓存 6.Bootstrap的防冲突 7.作用域外如何使用Button类 8.Bootstrap的单元测试 Bootstrap的作用域 Bootstrap每个插件都定义在下面这段作用域代码中: +function ($) { ... }(window.jQuery) 请看<IIFE>和<严格模式>编译环境. 在插件的作用