2016-11-09 18 views
0

問題:以下のコードは、デスクトップまたはランドスケープデバイスで正常に動作しています。しかし、モバイル/応答ビューに切り替えると、divの境界線が表示されません。私は下のコードで何が間違っているのか分かりません。この小さな問題から私を連れ出す人もいます。応答ビューの境界線内にdivが表示されない

ヘッドコード:

<meta name="viewport" content="width=device-width, initial-scale=1"> 

HTMLコード:

<div class="ah-header"> 
    <div class="ah-logo"></div> 
    <div class="ah-navbar-searchbar"></div> 
    <div class="ah-nav"></div> 
</div> 

CSSコード:

.ah-header { 
padding: 9px; 
background-color: rgb(25, 118, 210); 
display: table; 
width: 100%; 
min-height: 50px; 
max-height: 150px; 
.ah-logo { 
    display: table-cell; 
    width: 250px; 
    border: 1px solid yellow; 
} 
.ah-navbar-searchbar { 
    display: table-cell; 
    position: relative; 
    /* Firefox */ 
    width: -moz-calc(100% - 500px); 
    /* WebKit */ 
    width: -webkit-calc(100% - 500px); 
    /* Opera */ 
    width: -o-calc(100% - 500px); 
    /* Standard */ 
    width: calc(100% - 500px); 
    border: 1px solid yellow; 
} 
.ah-nav { 
    display: table-cell; 
    position: relative; 
    /* Firefox */ 
    width: 250px; 
    border: 1px solid yellow; 
} 
@media only screen and (max-width : 320px) { 
     .ah-header { 
      padding: 0px !important; 
      display: block !important; 
      max-height: 150px !important; 
     } 
     .ah-logo, .ah-navbar-searchbar, .ah-nav { 
      display: table-row !important; 
      border: 1px solid yellow; 
      height: 50px !important; 
     } 
} 
+1

あなたが '' '.ah-logo {'の前に '' ' – Banzay

答えて

1

あなたを設定しますdisplay: block;代わり

display: table-rowのサイドノートにクエリの.ah-logo, .ah-navbar-searchbar, .ah-navルールは、私はすべて削除!important彼らはここでは必要ありません、あなたは.ah-headerルール

.ah-header { 
 
    padding: 9px; 
 
    background-color: rgb(25, 118, 210); 
 
    display: table; 
 
    width: 100%; 
 
    min-height: 50px; 
 
    max-height: 150px; 
 
} 
 
    .ah-logo { 
 
    display: table-cell; 
 
    width: 250px; 
 
    border: 1px solid yellow; 
 
    } 
 

 
.ah-navbar-searchbar { 
 
    display: table-cell; 
 
    position: relative; 
 
    /* Firefox */ 
 
    width: -moz-calc(100% - 500px); 
 
    /* WebKit */ 
 
    width: -webkit-calc(100% - 500px); 
 
    /* Opera */ 
 
    width: -o-calc(100% - 500px); 
 
    /* Standard */ 
 
    width: calc(100% - 500px); 
 
    border: 1px solid yellow; 
 
    } 
 
    .ah-nav { 
 
    display: table-cell; 
 
    position: relative; 
 
    /* Firefox */ 
 
    width: 250px; 
 
    border: 1px solid yellow; 
 
    } 
 
    @media only screen and (max-width: 320px) { 
 
    .ah-header { 
 
     padding: 0px; 
 
     display: block; 
 
     max-height: 150px; 
 
    } 
 
    .ah-logo, 
 
    .ah-navbar-searchbar, 
 
    .ah-nav { 
 
     display: block; 
 
     border: 1px solid yellow; 
 
     height: 50px; 
 
    } 
 
    }
<div class="ah-header"> 
 
    <div class="ah-logo"></div> 
 
    <div class="ah-navbar-searchbar"></div> 
 
    <div class="ah-nav"></div> 
 
</div>

にブラケット }を逃したとして、
関連する問題