居中Twitter的引导按钮 [英] Centering a Twitter Bootstrap button

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

问题描述

我正在与Twitter的引导一种形式,和我有一个非常困难的时候为中心的按钮。它包含与7以下跨度的div里是HTML,按钮是在最底层。关于如何中心这件事的任何建议?

 < D​​IV CLASS =形式span7>
  < D​​IV ID =GET-开始>
    < D​​IV ID =形式,介绍>
      <强>< H1大于1。入门:一些基本的< / H1>< / STRONG>
    < / DIV>
    <窗​​体类=形横>
      < D​​IV CLASS =控制组>
        <标签类=控制标签为=inputSaving>什么是你节省<?/标签>
        < D​​IV CLASS =控制>
          <输入类=span4类型=文本ID =inputSaving占位符=例如游泳课,生日派对,大学基金等。>
        < / DIV>
      < / DIV>
      < D​​IV CLASS =控制组>
        <标签类=控制标签为=说明>添加一个简短描述< /标签>
        < D​​IV CLASS =控制>
          < TextArea类=span4ID =说明行=4占位=在你自己的话描述这个扑满储蓄目标>< / textarea的>
        < / DIV>
      < / DIV>
      < D​​IV CLASS =控制组>
        <标签类=控制标签为=categoryselect>选择一个类别< /标签>
        < D​​IV CLASS =控制>
          <选择类=span4ID =categoryselect>
            <! - 添加一些CSS和JS做一个占位符值 - >
            <期权价值=小猫>&小猫LT; /选项>
            <期权价值=键盘猫>键盘猫< /选项>
            <期权价值=微博鸟> Twitter的鸟< /选项>
          < /选择>
        < / DIV>
      < / DIV>
      < D​​IV CLASS =控制组>
        <标签类=控制标签为=imageselect>选择图像< /标签>
        < D​​IV CLASS =控制span4>
          < IMG SRC =piggyimage.pngID =imageselectALT =图像选择/>
        < / DIV>
      < / DIV>
      < D​​IV CLASS =控制组>
        <标签类=控制标签为=目标>您的储蓄目标< /标签>
        < D​​IV CLASS =控制>
          <输入类型=文本级=span4ID =目标占位符=$ 1337年>
        < / DIV>
      < / DIV>
      <按钮类=BTN BTN-大BTN-主要TYPE =按钮>提交< /按钮>
    < /表及GT;
  < / DIV>
< / DIV>


解决方案

引导有它自己的命名定心类的文本中心

< D​​IV CLASS =span7文本中心>< / DIV>

I'm making a form with Twitter Bootstrap, and am having a really difficult time centering the button. It's contained inside a div with a span of 7. Below is the HTML, and the button is at the very bottom. Any recommendations on how to center this thing?

<div class="form span7">
  <div id="get-started">
    <div id="form-intro">
      <strong><h1>1. Get Started: Some basics</h1></strong>
    </div>
    <form class="form-horizontal">
      <div class="control-group">
        <label class="control-label" for="inputSaving">What are you saving for?</label>
        <div class="controls">
          <input class="span4" type="text" id="inputSaving" placeholder="e.g. Swimming Lessons, Birthday Party, College Fund, etc.">
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="description">Add a short description</label>
        <div class="controls">
          <textarea class="span4" id="description" rows="4" placeholder="Describe in your own words the saving goal for this piggybank"></textarea>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="categoryselect">Choose a Category</label>
        <div class="controls">
          <select class="span4" id="categoryselect">
            <!-- Add some CSS and JS to make a placeholder value-->
            <option value="Kittens">Kittens</option>
            <option value="Keyboard Cat">Keyboard Cat</option>
            <option value="Twitter Bird">Twitter Bird</option>
          </select>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="imageselect">Choose an image</label>
        <div class="controls span4">
          <img src="piggyimage.png" id="imageselect" alt="image-select" />
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="goal">Your Saving Goal</label>
        <div class="controls">
          <input type="text" class="span4" id="goal" placeholder="$1337">
        </div>
      </div>
      <button class="btn btn-large btn-primary" type="button">Submit</button>
    </form>
  </div>
</div>

解决方案

Bootstrap has it's own centering class named text-center.

<div class="span7 text-center"></div>

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

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