在小屏幕上堆叠div

时间:2016-12-21 13:06:53

标签: twitter-bootstrap

@media (min-width: 1200px) {
    .navbar .container {
        width: 1170px;
    }
}

@media (max-width: 1199px) {
    .navbar .nav > li > a {
        padding: 10px 8px 10px 8px;
    }
    .navbar .nav > li > a.training {
        padding-right: 8px;
    }

}

@media (min-width: 1024px) and (max-width: 1034px) {
  .navbar .nav > li > a {
    padding-left: 8px;
    padding-right: 8px;
  }
 }



@media (min-width: 980px) {
    .callout .callout-inner {
        min-height: 155px;
    }

}
@media (min-width: 979px) {
    body {

    }
}
@media (max-width: 979px) {
    .front .callout .callout-inner {
        padding: 20px 20px 0 20px;
    }



    .front .callout h2 {
        margin-top: 12px;
    }
    .front .report-callout h2 {
        font-size: 26px;
        margin: 0 0px 41px 0;
    }
    .front .report-callout .callout-inner {
        padding: 30px 5px 11px 22px;
    }

    .nav-collapse{
        float: right;
    }
    .nav-collapse.in.collapse {
        float: right;
        -webkit-box-shadow: 0px 11px 13px rgba(50, 50, 50, 0.3);
        -moz-box-shadow:    0px 11px 13px rgba(50, 50, 50, 0.3);
        box-shadow:         0px 11px 13px rgba(50, 50, 50, 0.3);
        position: absolute;
        top: 58px;
        right: 20px;
    }
    .nav-collapse {
        position: absolute;
        top: 58px;
        right: 20px;
    }
    .navbar .btn-navbar {
        margin-top: 22px;
    }
    .navbar li.contact .dropdown-menu {
        display: block!important;
    }
    .navbar .dropdown {
        -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
        -moz-box-shadow:    0px 0px 0px rgba(0, 0, 0, 0);
        box-shadow:         0px 0px 0px rgba(0, 0, 0, 0);
    }

    .navbar li.contact .dropdown-menu {
        -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
        -moz-box-shadow:    0px 0px 0px rgba(0, 0, 0, 0);
        box-shadow:         0px 0px 0px rgba(0, 0, 0, 0);
    }
    .page-contact-hcc .navbar li.contact a.contact-hcc
    , .page-contact-list .navbar li.contact a.contact-hcc
    , .page-report-incident .navbar li.contact a.contact-hcc {
        color: #828282;
    }
    .navbar li.contact .dropdown-menu {
        border-radius: 0;
        border-left: 0px;

    }
    .navbar li.contact .dropdown-menu > li > a {
        padding: 9px 8px;
        font-size: 17px;
    }
    .navbar .nav li.dropdown > .dropdown-toggle .caret {
        display: none;
    }
    .navbar li.contact .dropdown-menu > li > a:hover
    , .navbar li.contact .dropdown-menu > li > a:focus
    , .navbar li.contact .dropdown-submenu:hover > a
    , .navbar li.contact .dropdown-submenu:focus > a
    , .page-contact-list .navbar li.contact a.contact-list
    , .page-report-incident .navbar li.contact a.report-incident{
        color: #b5000b;
        background-color: #f2f2f2!important;


        background: #f2f2f2;
    }
}
/** wider than iPad portrait **/
@media (min-width: 768px) {
    .navbar .nav {
        margin: 20px 0 0 0px;;
    }
    #hero-bg {
        background: #e2e2e2 ;
        height: 290px;
        width: 100%;
        display: block;
        position: absolute;
        z-index: -1;
    }
}
.sidebar-callout img {
    margin-bottom: 70px;
}
/** iPad Portrait **/
@media (width: 768px) {
    .front [class*="span"]
    ,.page-contact-hcc .contact-span {
        display: block;
        float: none;
        width: 100%;
        margin-left: 0;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }
    .front .row
    ,.page-contact-hcc .contact-row {
        margin-left: 0;
    }
    .front .callout h2 {
        margin-top: 21px;
    }
}
@media (max-width: 768px) {
    .nav-collapse.in.collapse {
        float: right;
    }
    .side-nav {
        display: none;
    }
    .front .callout h2 {
        margin-top: 21px;
    }
    .footer .copyright {
        text-align: left;
    }
    .callout .sidebar-callout {
        margin-top: 30px;
    }

}
/** smaller than iPad portrait **/
@media (max-width: 767px) {
    body {
        padding-right: 0;
        padding-left: 0;
    }
    #main .row{
        padding-left: 0;
        padding-right: 0;

    }
    #main {

    }

    .hero
    ,#main .row
    ,footer {
        padding-right: 15px;
        padding-left: 15px;
    }
    .hero {
        height: 265px;

        background-size: 100% 316px;
    }
    .hero-callout {
        width: 420px;
        position: relative;
        margin-left: auto;
        margin-right: auto;

    }
    .modal-header {
        padding:0px 15px;           
    }
    .modal-header h3 {
        font-size:14px;
                    
    }
    .modal-body{
        padding:0px;
    }    
}

/** iPhone landscape and smaller **/
@media (max-width: 480px) {
    #main .row{
        padding-left: 0;
        padding-right: 0;

    }
    #main {

    }
    .interior-header h1 {
        font-size: 27.5px;
    }
    .navbar .navbar-inner {
        height: 60px;
    }
    .navbar .brand {
        width: 70%;
    }
    .front .callout h2 {
        margin-top: 10px;
    }
    .navbar .btn-navbar {
        margin-top: 10px;
        margin-right: 0px;
    }
    .navbar .brand {
        padding: 15px 0 0px 0;
    }

    .navbar-fixed-top .navbar-inner {
        height: 65px;
    }
    .front .hero-callout h2{
        font-size: 18px;
        margin: 5px 0 5px 16px;
    }
    .front .hero-callout p {
        line-height: 15px;
        margin: 0px 15px 10px 15px;
    }
    .hero-callout .badge-updated {
        font-size: 9px;
        line-height: 12px;
        padding-right: 6px;
        padding-left: 6px;
    }
    .hero {
        position: relative;
        height: 130px;
        background: #e2e2e2 url('../images/hcc/hero-bg.jpg') no-repeat;
        background-size: 100%;
        padding: 0px 0;
        margin-bottom: 20px;
    }
    
    #RecentlyUpdatedArea {
        height:100px;
    }

    .hero-callout {
        width: 98%;

        position: absolute;
        margin-left: auto;
        margin-right: auto;
        top: 20px;
        left: 4px;
    }
    .front .report-callout .callout-inner {
        padding: 15px 5px 11px 22px;
    }
    .front .report-callout h2 {
        font-size: 21px;
        margin-top: 5px;
        height: 100px;
    }
    .front .report-callout p {
        padding-right: 0px;
    }

    a.change-filter {
        margin-left: 25px;
    }
    .interior-header h1{
        font-size: 24px;
    }
    .interior-header h1, .current-region {
        padding-left:  15px;
        line-height: 65px;
    }

    .current-region, .current-sector {
        font-size: 70%;
    }
    .report-incident-contant {

        padding: 20px 10px 20px 12px;
    }
    .grey-stripes p {
        font-size: 23px;
        line-height: 22px;
        top: 25px;
        left: 10px;
    }
    .red-block p{
        left: 8px;

    }
    .grey-stripes a, .red-block p, .red-block a {
        font-size: 28px;
        line-height: 29px;
        top: 33px;
    }
    #interior-bg {
        height: 65px;
        top: 60px;
    }
    .interior-header {
        margin-bottom: 0px;
    }
    .btn.btn-large.btn-credo-hotline {
        padding: 35px 35px;
    }
    .filter {
        font-size:16px;
        line-height:25px;
        padding-left:15px;
    }
    .modal-header {
        padding:0px 15px;           
    }
    .modal-header h3 {
        font-size:14px;
                    
    }
    .modal-body{
        padding:0px;
    }
    

}

body {
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 13px;
    color: #6e7075;
    position: relative;
    
}

.footerlinks{
	display:inline-block
}

.clear {
    clear: both;
}
.active-arrow {
    -webkit-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation = 3);
}
.btn-large [class^="icon-"], .btn-large [class*=" icon-"] {
    margin-top: 2px;
}
p {
    font-family: Georgia1, Georgia, serif;
}
.hero-callout-bg {
    display: block;
}
.hero-callout  {
    width: 539px;
    height: 210px;
    position: absolute;
    top: 45px;
}

.hero-callout h2 {
    color: #828282;
    font-size: 30px;
    line-height: 100%;
    font-weight: normal;
    text-transform: uppercase;
}
.hero-callout .badge-updated {
    font-size: 13px;
    line-height: 22px;
    background-color: #009bd4;
    padding-right: 10px;
    padding-left: 10px;
    -webkit-border-radius: 13px;
    -moz-border-radius: 13px;
    border-radius: 13px;
    font-weight: lighter;
    vertical-align: text-top;
    margin-top: 2px;
}

.front .callout {
    margin-bottom: 20px;

    background: #FFF;
}
.front .callout h2 {
    font-size: 23px;
    line-height: 100%;
    font-weight: normal;
    padding: 0 10px;
    margin-top: 0;

}
.front .callout .callout-inner {
    /*cursor: pointer;*/

    padding: 35px 20px 0 20px;
}
.red-brd, .front .callout .callout-inner, .training-content, .sidebar-callout, .report-incident-contant {
    border-left: 3px solid #b5000b;
}
.front .hero-callout .callout-inner {
    background: url('../images/hcc/transparent-bg.png') repeat;

    padding: 5px 5px 0 10px;
}
.front .hero-callout .callout-inner .btn {
    text-shadow: none;
}
.front .hero-callout h2, .front .hero-callout p {
    margin: 15px;
    color: #6e7075 !important;
}
.front .callout .align-left {
    float: left;
    margin: 0 20px 20px 0;
    width: 73px;
}
.front .callout p {
    margin-left: 94px;
}
.front .callout a.view-all {
    font-weight: bold;
    font-size: 15px;
    text-transform: capitalize;
}
a.view-all {
    font-weight: bold;
    font-size: 15px;
    text-transform: capitalize;
}
.front .report-callout {
    background: url('../images/hcc/grey_pattern.jpg') #6F7075 repeat-x;
    color: #FFF;
    background-position: bottom;
    min-height: 154px;

}
.front .report-callout .callout-inner {
    padding: 30px 22px 11px 22px;
}
.front .report-callout h2 {
    font-size: 28px;
    line-height: 100%;
    color: #fff;
    float: left;
    margin: 0 0px 20px 0;
    width: 135px;
    font-weight: lighter;
}
.front .report-callout p {

    padding-right: 5px;
}
.front .report-callout .btn{
    text-shadow: none;
    border: none;
    padding: 7px 15px;
}

#interior-bg {
    width: 100%;
    background: #e2e2e2;
    height: 138px;
    position: absolute;
    top: 60px;
    z-index: -1;
}

.interior-header {
    margin-bottom: 30px;
}

.section-html-content .interior-header {
    margin-bottom: 10px;
}


.interior-header h1 {
    margin-top: 0;
    color: #828282;
    line-height: 120px;
    font-size: 31.5px;
    font-weight: lighter;
    font-family: Tahoma, Geneva, sans-serif;
}
.interior-header div.hands {

}
.interior-header .hands img {
    margin-left: 10px;
}
.filter {
    margin-bottom: 15px;
    color: #6e7075;
    font-size: 22px;
    line-height: 31px;
}
a.change-filter {
    margin-left: 50px;
    font-size: 12px;
    color: #b5000b;
    font-weight: bold;
}
.modal-filter .modal-body {
    z-index: 999999;
    overflow-y: visible;
}
table.table {

    padding: 30px;
}
table thead tr {
    background: #FFF;
}
.doc-table thead th.title {
    padding-left: 36px;
    padding-top: 30px;
}
table td{
    border-top: 5px solid #FFF ;

}
.table td {
    border-top: 0px;
}


.doc-table td div.pdf
,.doc-table td div.video {
    padding-left: 50px;
    background-repeat: no-repeat;

}

.training-content {
    padding: 30px;
    background: #FFF;


}
.callout .sidebar-callout {
    background: #FFF;

    padding: 25px 10px 0 25px;
    min-height: 170px !important;
}
.sidebar-callout p.lead {
    font-size: 20px;
}
.sidebar-callout img {
    margin-right: 10px;
    margin-bottom: 50px;
}
.side-nav .nav-list {
    border-left: 4px solid #b5000b;
}
.side-nav .nav-list > li > a {
    padding-top: 22px;
    padding-bottom: 22px;
}
.page-contact-hcc .side-nav .nav-list > li.contact-hcc > a
,.page-contact-list .side-nav .nav-list > li.contact-list > a
,.page-report-incident .side-nav .nav-list > li.report-incident > a
,.side-nav .nav-list > li > a:hover
,.side-nav .nav-list > li.active > a {
    color: #fff;
    background: #b5000b;
}
.page-contact-hcc .form-wrapper {
    border-left: 3px solid #b5000b;
    background: #FFF;

}
.page-contact-hcc .form-wrapper {
    padding: 22px 20px 20px 35px;
}
.btn.btn-large.btn-credo-hotline {
    padding: 35px 58px;
    font-size: 31px;
    margin-top: 10px;
    margin-bottom:30px;
}

        
        @media only screen and (max-width: 600px) {
    
    /* Force table to not be like tables anymore */
    #StaticContentArea table, 
    #StaticContentArea thead, 
    #StaticContentArea tbody, 
    #StaticContentArea th, 
    #StaticContentArea td, 
    #StaticContentArea tr { 
        display: block; 
    }
 
    /* Hide table headers (but not display: none;, for accessibility) */
    #StaticContentArea thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
 
    #StaticContentArea tr { border: 1px solid #ccc; }
 
    #StaticContentArea td { 
        /* Behave  like a "row" */
        border: none;
        border-bottom: 1px solid #eee; 
        position: relative;
        padding-left: 50%; 
        white-space: normal;
        text-align:left;
    }
    
 
    #StaticContentArea td:before { 
        /* Now like a table header */
        position: absolute;
        /* Top/left values mimic padding */
        top: 20px;
        left: 1em;
        width: 35%; 
        padding-right: 10px; 
        white-space: nowrap;
        text-align:left;
        font-weight: bold;
    }
 
    /*
    Label the data
    */
    #StaticContentArea td:before { content: attr(data-title); }
}
        
<div class="hero">
<div class="row-fluid">
    <div class="span6">
        <!--template bindings={
          "ng-reflect-ng-for-of": "[object Object]"
        }-->
        <div class="hero-callout hero-callout-bg" id="RecentlyUpdatedArea">
            <div class="callout-inner clearfix">
                <h2 id="RecentlyUpdatedNumber">
                    RECENTLY UPDATED
                    <span class="badge badge-info badge-updated">
                        <a id="RecentlyUpdatedPop" ng-reflect-router-link="/content/recentUpd" ng-reflect-href="#/content/recentUpd" href="#/content/recentUpd">0</a>
                    </span>
                </h2>
                <p>Stay in the know with all that’s changing within HCC&amp;P—access all items added or updated within the last 30 days.</p>
                <p><a class="view-all" ng-reflect-router-link="/content/recentUpd" ng-reflect-href="#/content/recentUpd" href="#/content/recentUpd">View All<span class="arrow-btn">»</span></a></p>
            </div>
        </div>
    </div>
    <div align="right" class="span6 clearfix" style="margin-top: 40px">
        <div class="clearfix" id="custom-search-input">
            <div class="input-group">
                <input class="search-query form-control" placeholder="Search" type="text">
                <span class="input-group-btn">
                    <button class="btn btn-danger" type="button">
                        <i class="icon-search"></i>
                    </button>
                </span>
            </div>
        </div>
    </div>
</div>

我有以下HTML(我刚插入搜索框),我希望它们在小屏幕上堆叠。我必须留在版本2.3.2。使用默认的CSS和JS,没有自定义。现在,这两个div在小屏幕上合并。我希望他们堆叠。

<div class="hero">
        <div class="row-fluid">
            <div class="span6">
                <div *ngFor="let x of Items" id="A" class="hero-callout hero-callout-bg">
                    <div class="callout-inner clearfix">
                        <h2 id="n">
                            {{x.title}}
                            <span class="badge badge-info badge-updated">
                                <a id="RP" [routerLink]="x.routerLink">{{Count}}</a>
                            </span>
                        </h2>
                        <p>{{x.text}}</p>
                        <p><a [routerLink]="x.routerLink" class="view-all">{{x.text}}<span class="arrow-btn">»</span></a></p>
                    </div>
                </div>
            </div>
            <div class="span6 clearfix" align="right" style="margin-top: 40px">
                <div id="custom-search-input" class="clearfix">
                    <div class="input-group">
                        <input type="text" class="search-query form-control" placeholder="Search">
                        <span class="input-group-btn">
                            <button class="btn btn-danger" type="button">
                                <i class="icon-search"></i>
                            </button>
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>

输出HTML:

<div class="hero">
<div class="row-fluid">
    <div class="span6">
        <!--template bindings={
          "ng-reflect-ng-for-of": "[object Object]"
        }-->
        <div class="hero-callout hero-callout-bg" id="RecentlyUpdatedArea">
            <div class="callout-inner clearfix">
                <h2 id="RecentlyUpdatedNumber">
                    RECENTLY UPDATED
                    <span class="badge badge-info badge-updated">
                        <a id="RecentlyUpdatedPop" ng-reflect-router-link="/content/recentUpd" ng-reflect-href="#/content/recentUpd" href="#/content/recentUpd">0</a>
                    </span>
                </h2>
                <p>Stay in the know with all that’s changing within HCC&amp;P—access all items added or updated within the last 30 days.</p>
                <p><a class="view-all" ng-reflect-router-link="/content/recentUpd" ng-reflect-href="#/content/recentUpd" href="#/content/recentUpd">View All<span class="arrow-btn">»</span></a></p>
            </div>
        </div>
    </div>
    <div align="right" class="span6 clearfix" style="margin-top: 40px">
        <div class="clearfix" id="custom-search-input">
            <div class="input-group">
                <input class="search-query form-control" placeholder="Search" type="text">
                <span class="input-group-btn">
                    <button class="btn btn-danger" type="button">
                        <i class="icon-search"></i>
                    </button>
                </span>
            </div>
        </div>
    </div>
</div>

输出: Output on Chrome

1 个答案:

答案 0 :(得分:0)

像这样编辑第二个span6 div(包含搜索栏的div),添加id="searchSpan"

<div id="searchSpan" align="right" class="span6 clearfix" style="margin-top: 40px;">

添加将此添加到您的自定义CSS:

@media (max-width:768px){
  div.row-fluid>div.span6{
    clear:both;
  }
  #searchSpan{
    float:left;
  }
}