我如何将图片放入左侧单元格?

时间:2009-08-06 18:37:29

标签: html css layout

CSS代码:

#wrapper {margin:auto; width:100%;}
.container {display: table; width:100%;}
.row {display: table-row;}
.cell {display: table-cell; height: 100px;} 
#fixed {width:150px;}

HTML code:

<div id="wrapper">
<div class="container">
<div class="row">
<div class="cell" id="fixed">left cell</div>
<div class="cell">right cell</div>
</div>
</div>
</div>

如何将图片放入左侧单元格?假设图片宽150px,高100px。

2 个答案:

答案 0 :(得分:1)

如果你的意思是css,

.row { display:table:row ; background:url('images/myImage.png') no-repeat 0px 0px; }

在html中

<img src="images/myImage.png" />

答案 1 :(得分:0)

<div class="cell" id="fixed"><img src="path/to/image.ext" alt="my picture" style="width:100px; height:100px"></div>

HTML Images