-2

在我的屏幕顶部,我有一个 ASP.NET 超链接,其中包含代表公司和应用程序的图像。我想使用 CSS 图层将文本或一些显示文本的控件放置在代表 productEdition 的右下角的超链接/图像之上。

我无法发布 ASP.NET 超链接标记,因为它会导致错误,但它有一个 ImageUrl。哦,它在一个面板中。见下文:

<asp:panel ID="toppanel" CssClass='wrapper' runat="server">
<!--Top Menu-->           
<asp:panel id="menupanel" runat="server" CssClass="menusubwrapper">
    <asp:HyperLink ID="HeaderLink" runat="server" ImageUrl="~/images/Header.gif" NavigateURl="~/Default.aspx" ToolTip="Home Page">   
    </asp:HyperLink>
</asp:panel>

使用一些答案中的技术,我有这个工作 - 文字在图片的顶部,但它一直在左边。我需要它一直向右。

   <asp:panel ID="toppanel" CssClass='wrapper' runat="server">
        <!--Top Menu-->           
        <asp:panel id="menupanel" runat="server" CssClass="menusubwrapper">

         <div id="Header" style="position: relative; z-index: 1">
          <%--div style="position:absolute;z-index:1">--%>
              <asp:HyperLink ID="HeaderLink" runat="server" ImageUrl="~/images/Header.gif" 
              NavigateURl="~/Default.aspx" ToolTip="Home Page">   
              </asp:HyperLink>

               <div style="position:absolute;top:60px; right:400px; width:600px; height:100px; z-index:2;font-size:200%">
                   <b>Testing...</b>
               </div>
         <%--</div>--%>
 </div>`
4

4 回答 4

0

您可以创建一个 div 以将图像与其中的版本重叠。您可以在此处阅读有关重叠元素的信息:http: //www.w3schools.com/css/css_positioning.asp

希望这会有所帮助,祝你好运!

于 2013-06-27T20:26:11.580 回答
0

You could have a DIV wrapping around the linked image as well as around the text (also within a DIV). Give the wrapping DIV a style "position:relative" and give the text DIV absolute positioning. Or, instead of using absolute positioning, you could float it right or left, center it, using margins, etc.

于 2013-06-27T20:28:09.957 回答
0

这里有一些教程供您参考:

http://www.html.net/tutorials/css/lesson15.php

或者

http://www.xul.fr/en/css/text-over-image.php

于 2013-06-27T20:32:31.043 回答
0

这是解决方案:

<div id="Header" style="position: relative; z-index: 1">

                <asp:HyperLink ID="HeaderLink" runat="server" ImageUrl="~/images/Header.gif" 
                               NavigateURl="~/Default.aspx" ToolTip="Home Page"/>   

                <div style="position:absolute;top:60px; left:800px; width:600px; height:100px; z-index:2;font-size:200%">
                    <%--<b>Testing...</b>--%>
                    <asp:Label runat="server" ></asp:Label>
                </div>

            </div>
于 2013-06-28T17:39:22.443 回答