我正在製作一個包含圖像,標題,按鈕,源代碼的列表,並且在使用剩餘寬度的100%時遇到問題。CSS:使用剩餘寬度的100%
我的主要問題是我無法使<textarea>
使用所有剩餘的寬度和高度。
這裏就是我得到:
而我打算有:
下面的源代碼,CSS:
.listing {width:100%;background:#f1f1f1;display:table;}
.leftimage {clear:none;display:table-cell;padding:20px;}
.listing .information {padding: 20px;width:100%;display:table-cell;}
.listing .information .title {font-size:20px;color:#016b98;}
.listing .information .title a {color:#016b98;text-decoration:underline;}
.listing .information .outsideButton {float:left;padding-top:5px;padding-right:5px;clear:none;}
.listing .information .outsideButton {clear:right;}
.listing .information .outsideButton .button {border: 1px solid #626262;background:#d8d8d8;}
.listing .information .outsideButton .button .label {padding:5px;}
.listing .information .outsideButton .button .label a {color:#626262;}
HTML:
<div class="listing">
<div class="leftimage">
<div style="height:150px;"><!-- Allows to change image position on click without changing .listing size -->
<a><img class="preview" height="150px" src="img.png"></a>
</div>
</div>
<div class="information">
<div class="title">
<a>TITLE</a>
</div>
<div class="outsideButton">
<div class="button">
<div class="label">
<a>BUTTON 2</a>
</div>
</div>
</div>
<div class="outsideButton">
<div class="button">
<div class="label">
<a>BUTTON 3</a>
</div>
</div>
</div>
<div class="outsideButton">
<div class="button">
<div class="label">
<a>BUTTON 4</a>
</div>
</div>
</div>
<div class="outsideButton">
<div class="button">
<div class="label">
<a>BUTTON 5</a>
</div>
</div>
</div>
<!-- END OF BUTTONS -->
<!-- HERE I WANT TO DISPLAY THE TEXTAREA WITH HTML CODE -->
<div style="float:left;padding-top:10px;clear:left;width:100%;">
<textarea style="padding:0;margin:0;width:100%;"><?php echo htmlspecialchars("<div><span>Whatever...</span></div><div><span>Whatever...</span></div><div><span>Whatever...</span></div><div><span>Whatever...</span></div><div><span>Whatever...</span></div><div><span>Whatever...</span></div>"); ?></textarea>
</div>
<!-- END OF TEXTAREA WITH HTML CODE -->
</div><!-- END OF .information -->
</div>
謝謝。
SOLUTION: 套裝vertical-align:top;
爲每個表細胞
可能重複? http://stackoverflow.com/questions/1017880/expand-div-to-max-width-when-floatleft-is-set – conceptdeluxe
不是真的重複,因爲該帖子並沒有真正解決這個問題。我試圖讓'
是的,但如你發現你自己的父母本身沒有100%的寬度 - 這是因爲它是浮動的,這就是我的「重複」是指 – conceptdeluxe