2016-07-21 2 views
1

안녕하세요 미디어 스크린의 같은 줄에 두 개의 단추를 수평으로 정렬하고 싶습니다. 제발 CSS 도와주세요. 다음은 내가 시도하는 코드입니다.html 단추에 대한 미디어 쿼리

<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

어떤 화면 크기는 같은 줄에있는 버튼을 줄까? –

+0

화면 크기 : 768px –

답변

1

이 CSS는 768px 미만에서 작동합니다.

사용이 바이올린 here

추가 된이 CSS :

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

난 당신이 .ctext-wrapjustify-content: space-between;display:flex을 사용할 필요가 있다고 생각합니다.

미디어 쿼리를 사용하지 않고 원하는대로 만들 것입니다.

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

Working Fiddle

+0

디스플레이 : 플렉스; 브라우저를 부분적으로 지원합니까? – vivek

+0

@VIVEKRAJ'display : flex'는 지금까지의 모든 최신 브라우저에서 지원됩니다. https://css-tricks.com/snippets/css/a-guide-to-flexbox/ 및 http://caniuse.com/#feat=flexbox – ketan

+0

IE11은 어떻습니까? – vivek