2016-07-21 9 views
1

Hallo Ich möchte sowohl die Schaltfläche horizontal in der gleichen Zeile im Medien-Bildschirm ausrichten. Bitte helfen Sie mir mit CSS. Folgendes ist der Code, den ich versuche.Medien Abfrage für HTML-Button

<div class="ctext-wrap"> 
     <button type="button" class="btn offert-btn btn-next">Mer information<br></button> 
     <button type="button" class="btn btn-previous offert-btn">Föregående<br></button> 
    </div> 

    .ctext-wrap { 
     max-width: 100%; 
    } 
    .ctext-wrap { 
     max-width: 50%; 
     margin: 0px auto; 
     text-align: left; 
    } 


    .btn-next { 
     float: right; 
     min-width: 130px; 
    } 

    .offert-btn { 
     display: inline-block; 
     background: #213156 !important; 
     color: #fff !important; 
     font-weight: bold !important; 
     text-decoration: none !important; 
     margin-bottom: 20px !important; 
     border-radius: 0 !important; 
    } 

@media screen and (max-width: 768px) 
.ctext-wrap { 
    max-width: 100%; 
} 
+0

Welche Bildschirmgröße möchten Sie Taste in derselben Zeile? –

+0

Bildschirmgröße: 768px –

Antwort

1

Diese CSS arbeiten unter 768px.

Mit dieser Geige here

hat dieses Bild CSS:

@media screen and (max-width: 768px) { 
.ctext-wrap .btn { 
    display: block; 
    width: auto; 
    float: none; 
} 
0

Ich glaube, Sie display:flex in .ctext-wrap und justify-content: space-between; verwenden müssen.

Ich werde machen, was Sie wollen, ohne Medienabfrage zu verwenden.

.ctext-wrap { 
    display: flex; 
    justify-content: space-between; 
    margin: 0 auto; 
    max-width: 50%; 
    text-align: left; 
} 

Working Fiddle

+0

Anzeige: flex; Teilweise Unterstützung für Browser richtig? – vivek

+0

@VIVEKRAJ 'display: flex' Unterstützung in allen aktuellen Browsern bisher. https://css-tricks.com/snippets/css/a-guide-to-flexbox/ und http://caniuse.com/#feat=flexbox – ketan

+0

Was ist mit IE11? – vivek