Here is a sample code I’m working on:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 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">
.menu
{
border: 1px solid #C0C0C0;
color: #FFFFFF;
background-color: #66A6CC;
font-family: Cambria;
text-align: justify;
font-size: medium;
width: 200px;
padding:8px;
padding-left:0px;
text-indent:10px;
display:inline-table;
}
.menu:hover
{
background-color: #FFFFA6;
color: #000000;
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="float:left; margin:10px;">
<asp:Menu ID="Menu1" runat="server" StaticMenuItemStyle-CssClass="menu" >
<Items>
<asp:MenuItem Text="Menu row" Value="menurow"
NavigateUrl="Default2.aspx" ></asp:MenuItem>
<asp:MenuItem Text="Menu row" Value="menurow1"
NavigateUrl="Default2.aspx" ></asp:MenuItem>
<asp:MenuItem Text="Menu row" Value="menurow2"
NavigateUrl="Default2.aspx" ></asp:MenuItem>
</Items>
</asp:Menu>
</div>
</form>
</body>
</html>
I have a problem with hover. Here it is.
The whole cell should turn into yellow but it doesn’t do because of padding.
EDIT: I removed padding but same thing happens again. I think it’s because of display type. I tried most of display types but they are not convenient for a menu.
Solution: There is a problem with Chrome about rendering some components. There are online solutions, please Google “ASP.NET chrome menu problem”.
I got it working from copying your HTML code. The only thing I changed was adding a missing closing bracket to the “.menu:hover” class.
I tested the page in Firefox and Internet Explorer 8.
Padding shouldn’t be causing any issues with the yellow hover. What browser are you using?