ASP.NET Background image


I am using VS2005 C#.

I have a .aspx 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 <div> 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

This question is tagged with c# html

~ Asked on 2011-12-05 09:46:31

The Best Answer is


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 {


~ Answered on 2011-12-05 09:54:41


write code in body tag like this

<body style="background-image: url('Image URL');" >

~ Answered on 2013-08-16 09:44:15

Most Viewed Questions: