473,748 Members | 2,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stretching the background image instead of tiling

Hi,

I have created a user control which has the html code as follows
<TABLE id="ToolBarTabl e" cellSpacing="0" cellPadding="0" width="100%"
border="0">
<tr>
<td align="right" bgColor="#00000 0"><IMG src="../Images/image1">
</td>
</tr>
<TR>
<TD id="mastHead" runat="server">
<asp:Label id="lHeading" runat="server" CssClass="heade r"></asp:Label></TD>
</TR>
</TABLE>

In the Page_Load method I am setting the properties of mastHead column like
this

Me.mastHead.Att ributes.Add("ba ckground",
"../images/mastheads/masthomedefault .jpg")
Me.mastHead.Att ributes.Add("he ight", "101")
Me.mastHead.Att ributes.Add("wi dth", "100%")

'* Handles the Heading label
Me.lHeading.Tex t = "This could be the Company Name"

Now the problem is if the width of a table is larger than the image width,
it is tiling the background image. I would like the background image to be
stretched instead of tiling it? Is there a property to do that? Or is there
any other way to do this?

Thanks,
Sridhar.
Nov 23 '05 #1
3 9394
You should try CSS to set the background image. Then you can tell the
browser whether to tile, stretch, or use fixed placement for the image
without modifying your code.

Here's an example of tiling horizontally:

TD
{
background-image: url(someimage);
background-repeat: repeat-x;
}

Nov 23 '05 #2
Hi,

I have tried that. If the size of a table cell exceeds the size of image,
then it is repeating(tilin g) the image. I need to stretch the image instead
of repeating it like in <img> tag if the width of image is 1000 and if I set
the width to 1300 it will stretch the image. Is there a css property to do
that?

Thanks,
Sridhar.

"yubyub" wrote:
You should try CSS to set the background image. Then you can tell the
browser whether to tile, stretch, or use fixed placement for the image
without modifying your code.

Here's an example of tiling horizontally:

TD
{
background-image: url(someimage);
background-repeat: repeat-x;
}

Nov 23 '05 #3
I'm afraid there isn't one that does that.
One way to do it is to use absolute position to put an image behind the
table and resize it.
A probably better solution is to center the background image in the table.
Use the following css rules to center the image and stop if from repeating:

background-position: center;
background-attachment: fixed;
background-repeat: no-repeat;

Best regards,
Mats

Sridhar wrote:
Hi,

I have tried that. If the size of a table cell exceeds the size of image,
then it is repeating(tilin g) the image. I need to stretch the image instead
of repeating it like in <img> tag if the width of image is 1000 and if I set
the width to 1300 it will stretch the image. Is there a css property to do
that?

Thanks,
Sridhar.

"yubyub" wrote:

You should try CSS to set the background image. Then you can tell the
browser whether to tile, stretch, or use fixed placement for the image
without modifying your code.

Here's an example of tiling horizontally:

TD
{
background-image: url(someimage);
background-repeat: repeat-x;
}

Nov 30 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
16123
by: lorelei | last post by:
Hey all, I have found two seperate HTML codes which claim to stop background images from being tiled. Neither of them seem to be working. I'm writing my codes in Textpad, and use Internet Explorer 6 for my browser. Below you will find the two codes I've found. Can anyone tell me why the hell they're not working?! This is driving me insane... moreso!!!!
27
13581
by: Kevin Yu | last post by:
When I declare on HTML page <LINK href="mycss.css" type="text/css" rel=stylesheet /> .... <BODY class=myclass> in mycss.css BODY { FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY: Arial, Geneva; background-image: url(images/back.jpg); }
8
3773
by: Ron Holmes | last post by:
I want to place a background image on a windows form. Is there a way to prevent the image from Tiling without using an image box resized to the size of the form? I am using Visual Studio 2003 .NET. This is an easy thing to do in VB6.
6
9481
by: John Ortt | last post by:
Hi there everyone, I have a part info form which has a faded image of our company logo as a background. I want to replace the faded image with a bright red warning image on items which have run out of purchasing cover. I am nearly there, the only problem is that the code below only changes the image background for text and combo-box backgrounds, it doesn't apply it to the whole form.
3
3243
by: Viken Karaguesian | last post by:
Hello all, I need somehelp with background tiling. I have a sneaking suspicion that what I want to do is not possible, but I'll ask anyway. :>) First some background: Here's the site in question: www.sayatnova.com (I'm sure many of you have seen this before as I've often asked for help). I've come a long way since I first created the site many moons ago and I'm trying to convert it to a (1) Table-less, (2) Frame-less and (3) Validated...
16
14629
by: Walker | last post by:
I have a span containing two words. Eg. <span>Avant Garde</span> Using CSS, I pad the text to the right and assign a background-image. Eg. span { padding: 0 3px 0 11px; background: url(images/tagbull.gif) no-repeat 0px 2px; }
4
1785
by: Arthur Dent | last post by:
Hello all... i have a really frsutrating problem here... This is only happening in IE (6 & 7b2), Mozilla and Netscape are both OK. I have a top-level table with a width of 760px, so it should be 760 minimum and stretching wider as needed to fit content (such as bound datagrids). In the top TR/TD, i have a header table which is width of 100%, and has three TD's. Each contains one image file, with the middle TD being set to width 100%. So...
4
13723
by: Steve Dambrowski | last post by:
How do I make my background image fit the screen so no one has to scroll, and at the same time it's not tiled looking?? I have one that is 800x600 and one that is 1084x768. The small one tiles.. and the big one cuts off the bottom. http://www.azclan.net/index2.html is currently the larger jpg.
4
5747
by: Bob Altman | last post by:
Hi all, I posted an earlier question to the microsoft.public.inetserver.asp.general newsgroup asking how to set the background of a client-side table cell to a gradient, and I received this answer: How do I stretch the static image? The Style property builder for a table cell lets me specify the background image location, tiling, scrolling, and position. But I can't find any obvious way to tell it to stretch the image
0
8995
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8252
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.