如何在Bootstrap中更改div标签的顺序?

时间:2016-02-24 12:35:46

标签: html css twitter-bootstrap

我想更改此page中div标签的序列,其中搜索按钮位于第一个位置,然后是who sectionwhen sectionwhere section。换句话说,我想颠倒部分的顺序。我想仅在大(lg)屏幕中更改div的序列。我无法在HTML文件中更改div的位置。

我做错了什么?

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">-->
    <link href="bootstrap_Cerulean.min.css" rel="stylesheet" />
    <link href="style.css" rel="stylesheet" />
    <link href="responsive.css" rel="stylesheet" />
</head>

<body dir="rtl">

<div class="row">
    <div class="form-group col-sm-6 col-md-3">
        <h4 class="title">Where</h4>
        <label>Your Destination</label>
        <input type="text" class="input-text full-width" placeholder="enter a destination or hotel name">
    </div>

    <div class="form-group col-sm-6 col-md-4">
        <h4 class="title">When</h4>
        <div class="row">
            <div class="col-xs-6">
                <label>Check In</label>
                <div class="datepicker-wrap">
                    <input type="text" class="input-text full-width hasDatepicker" placeholder="mm/dd/yy" id="dp1456316268201"><img class="ui-datepicker-trigger" src="images/icon/blank.png" alt="" title="">
                </div>
            </div>
            <div class="col-xs-6">
                <label>Check Out</label>
                <div class="datepicker-wrap">
                    <input type="text" class="input-text full-width hasDatepicker" placeholder="mm/dd/yy" id="dp1456316268202"><img class="ui-datepicker-trigger" src="images/icon/blank.png" alt="" title="">
                </div>
            </div>
        </div>
    </div>

    <div class="form-group col-sm-6 col-md-3">
        <h4 class="title">Who</h4>
        <div class="row">
            <div class="col-xs-4">
                <label>Rooms</label>
                <div class="selector">
                    <select class="full-width">
                        <option value="1">01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                    </select>
                    <span class="custom-select full-width">01</span>
                </div>
            </div>
            <div class="col-xs-4">
                <label>Adults</label>
                <div class="selector">
                    <select class="full-width">
                        <option value="1">01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                    </select>
                    <span class="custom-select full-width">01</span>
                </div>
            </div>
            <div class="col-xs-4">
                <label>Kids</label>
                <div class="selector">
                    <select class="full-width">
                        <option value="1">01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                    </select>
                    <span class="custom-select full-width">01</span>
                </div>
            </div>
        </div>
    </div>

    <div class="form-group col-sm-6 col-md-2 fixheight">
        <label class="hidden-xs">&nbsp;</label>
        <button type="submit" class="full-width icon-check animated bounce" data-animation-type="bounce" data-animation-duration="1" style="animation-duration: 1s; visibility: visible;">SEARCH NOW</button>
    </div>
</div>

<script src="jquery.js"></script>
<script src="bootstrap.min.js"></script>

</body>
</html>

1 个答案:

答案 0 :(得分:2)

您应该查看bootstrap文档中的column ordering部分

至于您的示例,请尝试此操作(注意col-lg-push*col-lg-pull*类):

<div class="row">
    <div class="form-group col-sm-6 col-md-3 col-lg-push-9">
        <h4 class="title">Where</h4>
        <label>Your Destination</label>
        <input type="text" class="input-text full-width" placeholder="enter a destination or hotel name">
    </div>

    <div class="form-group col-sm-6 col-md-4 col-lg-push-2">
        <h4 class="title">When</h4>
        <div class="row">
            <div class="col-xs-6">
                <label>Check In</label>
                <div class="datepicker-wrap">
                    <input type="text" class="input-text full-width hasDatepicker" placeholder="mm/dd/yy" id="dp1456316268201"><img class="ui-datepicker-trigger" src="images/icon/blank.png" alt="" title="">
                </div>
            </div>
            <div class="col-xs-6">
                <label>Check Out</label>
                <div class="datepicker-wrap">
                    <input type="text" class="input-text full-width hasDatepicker" placeholder="mm/dd/yy" id="dp1456316268202"><img class="ui-datepicker-trigger" src="images/icon/blank.png" alt="" title="">
                </div>
            </div>
        </div>
    </div>

    <div class="form-group col-sm-6 col-md-3 col-lg-pull-5">
        <h4 class="title">Who</h4>
        <div class="row">
            <div class="col-xs-4">
                <label>Rooms</label>
                <div class="selector">
                    <select class="full-width">
                        <option value="1">01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                    </select><span class="custom-select full-width">01</span>
                </div>
            </div>
            <div class="col-xs-4">
                <label>Adults</label>
                <div class="selector">
                    <select class="full-width">
                        <option value="1">01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                    </select><span class="custom-select full-width">01</span>
                </div>
            </div>
            <div class="col-xs-4">
                <label>Kids</label>
                <div class="selector">
                    <select class="full-width">
                        <option value="1">01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                    </select><span class="custom-select full-width">01</span>
                </div>
            </div>
        </div>
    </div>

    <div class="form-group col-sm-6 col-md-2 col-lg-pull-10 fixheight">
        <label class="hidden-xs">&nbsp;</label>
        <button type="submit" class="full-width icon-check animated bounce" data-animation-type="bounce" data-animation-duration="1" style="animation-duration: 1s; visibility: visible;">SEARCH NOW</button>
    </div>
</div>