【问题标题】:How would I put a picture into the left cell?我如何将图片放入左侧单元格?
【发布时间】:2009-08-07 02:43:26
【问题描述】:

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 代码:

<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 高。

【问题讨论】:

    标签: html css layout


    【解决方案1】:

    如果你的意思是css,

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

    在html中

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

    【讨论】:

      【解决方案2】:
      <div class="cell" id="fixed"><img src="path/to/image.ext" alt="my picture" style="width:100px; height:100px"></div>
      

      HTML Images

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-05-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多