简体   繁体   English

将按钮放在表格单元格中的图像上方

[英]Positioning a button over an image within a table cell

I have a table cell where an image is the full width and height of the cell. 我有一个表格单元格,其中图像是单元格的完整宽度和高度。 I want to position a button to the top right of the cell on top of the image. 我想在图像上方的单元格右上方放置一个按钮。 I can imagine this can be achieved with CSS. 我可以想象这可以通过CSS来实现。

( Note: I do not wish to use the image as a background image for the cell! ) 注意:我不希望将该图像用作单元格的背景图像!

HTML HTML

<td class="ImageHomeBandCenterArea">

    <img src="/CorporateWebsite/Interface/AdminUploads/MarketingEndImages/TopImageBar_Center.png"
                alt="Center Graphic" />

    <input type="button" value="GET IN TOUCH" class="OrangeImageBannerButton" />

</td>

CSS Styles CSS样式

.ImageHomeBandCenterArea
{
    width: 1024px;
    vertical-align:top;
}


.OrangeImageBannerButton
{
    background-color:#ed6b1f;
    color:#ffffff;
    padding-left:25px;
    padding-right:25px;
    padding-top:10px;
    padding-bottom:10px;
    font-weight:bold;
    font-size:14px;
    cursor:pointer;
    border:none;    
}

Many thanks in advance for anyone who takes the time to answer this! 在此先感谢您抽出宝贵的时间来回答这个问题!

Use the CSS property "z-index" for this task. 为此任务使用CSS属性“ z-index”。 it defines, in which order the elemts are printed on the screen. 它定义了要素在屏幕上的打印顺序。 Also, you might want to use absolute positioning for your button. 另外,您可能希望对按钮使用绝对定位。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM