2016-06-28 8 views
0

trtableにあります。 onClickはいくつかhtmlを追加します。私はtrにトランジションをうまく追加しようとしているので、高さを0に設定しようとしています。その後、onClickをautoに設定します。子要素にかかわらずdivを0にする

しかし、divは高さ0ではありません。height: 0;を追加できますが、それでも高さは保持されます。

マイHTML:

<tr class="info_container"> 
    <td colspan="7">Pick a time 
     <button id="time_btn">Button</button> 
     <span class="tickets_left_cont"> 7 tickets left</span> 
    </td> 
</tr> 

CSS:

.info_container { 
    background: #fff; 
    color: #000; 
    z-index: 999; 
    left: 0; 
    width: 100%; 
    padding: 15px; 
    -webkit-transition: all 1s ease-in-out; 
    -moz-transition: all 1s ease-in-out; 
    -o-transition: all 1s ease-in-out; 
    transition: all 1s ease-in-out; 
    opacity: 0; 
    text-align: left; 
    font-family: BreeSerifLt; 
    border-bottom: 3px solid #000; 
} 

#time_btn { 
    outline: 0; 
    padding: 10px; 
    background: #9A0FC7; 
    border: 0; 
    color: #fff; 
    display: block; 
    margin-top: 10px; 
    font-weight: 300; 
    font-family: BreeSerifLt; 
} 

は私が間違って何をしているのですか? info_containerクラスの高さを0にすることができないので、divを隠すことができないのはなぜですか?

ありがとうございます!

+0

可能重複[テーブル列を設定し、そのセル内のテキストの量に関係なく一定の幅?](http://stackoverflow.com/questions/ 4457506/set-the-table-column-width-constant-of-the-text-in-its-cellに関係なく) –

答えて

1
テーブルで

heightmin-heightとしてwidth挙動とのmin-width

+0

ああ、ありがとう、私はそれを知らなかった。だから、テーブル内の要素の高さを変更したいときは、 'max-height'を使う必要がありますか? – PourMeSomeCode

+0

ここをクリックしてください:http://stackoverflow.com/questions/5286747/how-to-force-a-td-to-be-a-certain-height-with-css –

関連する問題