c# - ASP.NET 背景图片

标签 c# asp.net html

我正在使用 VS2005 C#。

我有一个 .aspx登录页面,我想为它实现一个背景图像。下面是我当前页面的截图:

enter image description here

下面是我的后台代码:

    <div align="center" style="background-color: transparent; background-image: url(Images/blue.jpg);">
<asp:login id="Login1" runat="server" font-size="Large" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" ForeColor="#333333" DestinationPageUrl="~/Common/Default.aspx" DisplayRememberMe="False" FailureText="Login failed" RememberMeSet="False" Height="224px" Width="384px">
    <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
    <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
   <TextBoxStyle Font-Size="0.8em" />
    <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
    Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
</asp:login>
</div>

我试着把 <div>标记在外面,但背景图像似乎卡在了登录控件的宽度和高度上。

我可以知道如何扩展图像以覆盖整个背景吗?

谢谢

最佳答案

1) 使用 CSS 样式表 - 添加 <link rel="stylesheet" type="text/css" href="styles.css" />包括它。

2) 将背景应用到正文:

body {
    background-image:url('images/background.png');
    background-repeat:no-repeat;
    background-attachment:fixed;
}

参见:

http://www.w3schools.com/css/css_howto.asp

http://www.w3schools.com/cssref/pr_background-position.asp

关于c# - ASP.NET 背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8383424/

相关文章:

javascript - 在javascript中处理提示?

PHP 表。在新组之前显示总计

c# - 此代码如何工作的说明 (C#)

c# - 对 global.asax 感到困惑?

c# - 制作像泰拉瑞亚这样的灯光系统?

c# - Unity DI 更新至版本 5

asp.net - LINQ - 'Could not translate expression' 以及以前使用过且经过验证的查询条件

html - 显示 :flex or height:auto not working

c# - 重写结构中的 Equals 方法

c# - 当我在 ServiceFabric 群集上使用 EventFlow 监听 ETW 事件时出现“系统资源不足”