Menu background colors not set when CSS used.

G

Guest

My simple example is shown below. Please can you explain why the BackColor of
the menu's StaticSelectedStyle and StaticHoverStyle are not applied whilst
the background-color of the tr and td's are applied via the style. Thanks.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
tr{background-color: ButtonFace;}
td{background-color: ButtonFace;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr style="height: 200px;">
<td style="width: 200px;">
<asp:Menu ID="Menu1" runat="server">
<StaticSelectedStyle BackColor="Blue" />
<StaticHoverStyle BackColor="Red" />
<Items>
<asp:MenuItem Text="One"
Value="One"></asp:MenuItem>
<asp:MenuItem Text="Two"
Value="Two"></asp:MenuItem>
<asp:MenuItem Text="Three"
Value="Three"></asp:MenuItem>
</Items>
</asp:Menu>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
 
Y

Yuan Ren[MSFT]

Hi Richard,

Thanks for posting!

For the current issues, both StaticSelectedStyle and StaticHoverSytle
property aren't applied because that the menu control is rendered as td
element on the client side. However, you have set the style of td and tr
element by your own style. If you want to make these properties available,
I suggest you remove your own style for the page.

Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 
G

Guest

Ok, I understand that the menu control is rendered as a td on the client
side, but surely the CSS order of precedence means the styles set for these
td's override any styles set in local or external styles?

You suggest that I "remove your own style for the page" but surely this
contradicts the whole idea of CSS. I want to implement a website-wide style
for all <tr> and <td> elements (so I'll put these in an external style sheet)
but, if I understand you correctly, this will mean that I can't set any
styles for any of the menu controls.
 
Y

Yuan Ren[MSFT]

Hi Richard,

Thanks for posting!

I understand your current issue. I think the specific way to approach your
demand is remove the style from whole td or tr style and write your own
customize style. This means you define the customize style in the css file
likes the ".MyStyle". And then, you can mark the td element as :
<td class="MyStyle">
The same as tr element. Please notes don't mark the td or tr element which
contains the menu control. Thanks for your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top