0

パネルに div があります。これに画像を追加します。

画像を DIV コンテナーの下部に配置したかった (画像を一列に表示)。

<asp:Repeater ID="product" runat="server">
   <ItemTemplate>
      <div style="float: right; width: 180px; height: 177px; margin: 0 30PX 10px 5px">
         <asp:Panel ID="Panel1" runat="server">
            <font color="white">
            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>'></asp:Label></font>
            <br />
            <div style="height:140px ; overflow:hidden">
               <asp:Image ID="Image1"  runat="server"  Width="120px" ImageUrl='<%#  Eval("Image") %>' ImageAlign="Bottom" />
           </div>
        </asp:Panel>
     </div>
  </ItemTemplate>

4

2 に答える 2

1

asp ImageAlign プロパティに依存しないでください。次のような CSS を使用します。

<div style="float: right; width: 180px; height: 177px; margin: 0 30px 10px 5px; position:relative">
   <div id="panel"
        <label>Name</label>
        <img id="Image1" src='img-url-goes-here' style="position:absolute;bottom:0px;height:40px;display:block;" />
    </div>
</div>​

コードでは次のようになります。

<div style="float: right; width: 180px; height: 177px; margin: 0 30px 10px 5px;">
    <asp:Panel ID="Panel1" runat="server">
        <font color="white">
            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>'></asp:Label>    
        </font>
        <div style="overflow:hidden;height:140px; position:relative;">
            <asp:Image ID="Image1"  runat="server"  Width="120px" ImageUrl='<%# Eval("Image") %>' style="position:absolute; bottom:0px; height:40px; display:block;" />
        </div>
    </asp:Panel>
</div>
于 2012-11-24T09:36:43.627 に答える
0

vertical-align:bottom画像 div で使用する

<asp:Repeater ID="product" runat="server">
       <ItemTemplate>
          <div style="float: right; width: 180px; height: 177px; margin: 0 30PX 10px 5px">
             <asp:Panel ID="Panel1" runat="server">
                <font color="white">
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>'></asp:Label></font>
                <br />
                <div style="height:140px ; overflow:hidden; vertical-align:bottom">
                   <asp:Image ID="Image1"  runat="server"  Width="120px" ImageUrl='<%#  Eval("Image") %>' ImageAlign="Bottom" />
               </div>
            </asp:Panel>
         </div>
      </ItemTemplate>
    </asp:Repeater>
于 2012-11-25T15:39:26.660 に答える