gymcode gymcode - 1 year ago 131
HTML Question

ASP.NET Background image

I am using VS2005 C#.

I have a

login page and I would like to implement a background image to it. Below is my current page screenshot:

enter image description here

Below is my background code:

<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" />

I tried to put the
tag outside, but the background image just seems stuck with the login control's width height.

May I know how can I extend the image to cover the whole background?

Thank you

Answer Source

1) Use a CSS stylesheet - add <link rel="stylesheet" type="text/css" href="styles.css" /> to include it.

2) Apply the background to the body:

body {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download