473,657 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

background image for menu control in ASP.NET 2.0?

H
is it possible to add a background image to the menu items?

I can add an image, but it displays on top of the text of the menu
items.

How can I add the image and still have the text in the foreground?

Thanks...
H

Jul 25 '06 #1
2 5819
Hi H,

You need to do add the image through a CSS style. Look for the
background-image attribute. Here's a quick example.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]
<%@ Page Language= "VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<style type="text/css">
.menuItem
{
color:black;
border:Solid 1px Gray;
background-color:#c9c9c9;
background-image : url(http://www.gc.ca/images/lfblt.gif);
padding:2px 5px;
}
</style>
<title>Menu Templates</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Menu
id="Menu1"
Orientation="Ho rizontal"
StaticMenuItemS tyle-CssClass="menuI tem"
DynamicMenuItem Style-CssClass="menuI tem"
Runat="server">

<Items>
<asp:MenuItem Text="Produce">
<asp:MenuItem Text="Apples" />
<asp:MenuItem Text="Oranges" />
</asp:MenuItem>
<asp:MenuItem Text="Beverages ">
<asp:MenuItem Text="Soda">
<asp:MenuItem Text="Coke" />
<asp:MenuItem Text="Pepsi" />
</asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>

</div>
</form>
</body>
</html>

"H" <ha*********@gm ail.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
is it possible to add a background image to the menu items?

I can add an image, but it displays on top of the text of the menu
items.

How can I add the image and still have the text in the foreground?

Thanks...
H

Jul 26 '06 #2
H
it did...

thanks Ken


Ken Cox [Microsoft MVP] wrote:
Hi H,

You need to do add the image through a CSS style. Look for the
background-image attribute. Here's a quick example.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]
<%@ Page Language= "VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<style type="text/css">
.menuItem
{
color:black;
border:Solid 1px Gray;
background-color:#c9c9c9;
background-image : url(http://www.gc.ca/images/lfblt.gif);
padding:2px 5px;
}
</style>
<title>Menu Templates</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Menu
id="Menu1"
Orientation="Ho rizontal"
StaticMenuItemS tyle-CssClass="menuI tem"
DynamicMenuItem Style-CssClass="menuI tem"
Runat="server">

<Items>
<asp:MenuItem Text="Produce">
<asp:MenuItem Text="Apples" />
<asp:MenuItem Text="Oranges" />
</asp:MenuItem>
<asp:MenuItem Text="Beverages ">
<asp:MenuItem Text="Soda">
<asp:MenuItem Text="Coke" />
<asp:MenuItem Text="Pepsi" />
</asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>

</div>
</form>
</body>
</html>

"H" <ha*********@gm ail.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
is it possible to add a background image to the menu items?

I can add an image, but it displays on top of the text of the menu
items.

How can I add the image and still have the text in the foreground?

Thanks...
H
Jul 26 '06 #3

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

Similar topics

5
6463
by: seajays | last post by:
OK, I've managed to get just about everything working in CSS and XHTML, but there is one last peice of the jigsaw. http://www.seajays.org.uk/2know_dev/ At the moment on the site, I have a gray striped background behind the left hand menu. This was achieved using a body background image. It looks OK, until you change the size of the text in the browser (i.e. larger, smaller etc), and then the menu items start to float out past
4
1858
by: ruca | last post by:
How can I set body background with an image, but centered and not tiled? When I put background="image1", it fills my page with the image many times. I only want to put at the beggining and centered. I don't won't to use <img src="image1"> because I have a choice menu that I want over the image. -- Thank's (if you try to help me)
3
3230
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...
10
5693
by: Karl-Inge Reknes | last post by:
Hi, Can anyone tell me how to change a table cells background color or background image in runtime with C#. Karl-Inge
0
808
by: NH | last post by:
Asp.net 2.0. Is it possible to put a background image on a menu control? I cant see how to do it, I can set the background color but I want to use an image with shadow effects etc. Thanks N
1
12009
by: sthrudel | last post by:
Hello! I'm programmatically inserting a navigation asp menu to a page, like this: // Create new Menu Menu menu = new Menu(); // Create new MenuItem MenuItem mainItem = new MenuItem();
4
2819
by: Philipp Kraus | last post by:
Hi, I have one problem with my position of my background image. I have created one div-tag that has a background image, which should be fixed during scrolling. On the left side of the div is my menu-div, so the content div is shown round 25% from the left browser side. In this content div I would like to position a image on the left or right side. I need a background-attachment: static, because the layout position is the div, not the...
16
4926
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of "background" or "background-image", the positioning only works with specifying pixels. If I specify the vertical position in pixels, the image gets cut-off at the bottom. I don't know what to do and would appreciate anyone's help. Specifically the code...
2
14067
by: thephatp | last post by:
I'm having a problem with IE rendering correctly. I'm experimenting with using all div's in my pages now, and I'm not very familiar with the quirks of IE. I have created a sample page, and I'm really confused as to what is going on in IE. FF renders the page exactly as I expect. IE renders the page with everything in the correct location, but it seems to double the background image for a sub-div section that is moved up using a negative...
0
8399
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
8827
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
8732
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...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
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...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
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
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.