Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i m creating application in which i take table control in that table control i m apply background image in table. but image size is show small it not display whole image,it display only half part of image , i want to view whole image not half part of image. below i write source code of table control.

<table width="30%" height="60%" align="center" cellpadding="5" border="0" cellspacing="4"
style=" background-image:url('img/canteen.jpg'); ">

<tr>
<td align="right" width="45%" >
<br />
<asp:Label ID="lblLoginID" runat="server" Text="Login ID"
CssClass="label" ForeColor="Aqua" ></asp:Label>
&nbsp;&nbsp;&nbsp;
</td>

<td align="left" >
<br />
<pre></pre><asp:TextBox ID="txtLoginID" runat="server" CssClass="textbox" Width="148px"
></asp:TextBox>
</td>
</tr>
<tr>
<td width="45%" align="right">
<asp:Label ID="lblPassword" runat="server" Text="Password"
CssClass="label" ForeColor="Aqua" ></asp:Label>
&nbsp;
</td>
<td align="left">
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" CssClass="textbox" Width="149px" ></asp:TextBox>
</td>

</tr>
<tr>
<td colspan="2" align="center">
<asp:ImageButton ID="btnSubmit" runat="server" Text="Login"
ImageUrl ="~/img/lo1.jpg" Height="30px" OnClick="btnSubmit_Click" />

</td>
</tr>

</table>
Posted
Updated 25-Aug-16 2:31am

I think You are using Higher Resolution Image ('img/canteen.jpg') ,
try to resize the image according to your table size

and use

background-position: center; background-image: url('img/canteen.jpg'); background-repeat: no-repeat

that should do the trick
 
Share this answer
 
To make background full size please give {width: 100%; height: 100%; background-size:cover;} for image but image width is less then screen means,image not look good.
 
Share this answer
 
Comments
Richard Deeming 25-Aug-16 9:44am    
This question was asked, answered, and solved over FOUR YEARS AGO.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900