If you haven't used the static menu item style and dynamic menu item styles for the menu control, parent Div css class should apply css styles like foreColor, Backcolor, font-weight and so on. If you set up Menu Styles, menu css will supersede the parent
css class.
I think there is something wrong with the Menu control. Here's what I found out. If I use the HyperLink control then it displays exactly what I wanted. The styles from the CSS works like it should. However, if I put the Menu control back on, all the format
from the CSS are gone. Any suggestion? In my example, I use the DIV tag with a CssClass and take the CssClass property out of the Menu control. Again, it works fine with HyperLink control though.
Have you checked what the element classed as in your page source? I've been playing with Menu's and CSS the last few days, and I noticed it will rename things somewhat weirdly.
For example I have my nav menu in a login view, and then in its div so it named it "#LoginViewID_DivID" and Classed it as the specified CssClass. But then for some reason it also classed all the links individually as "level1" which seems to override the
CssClass set in your menu
I wish I could turn this auto-cssing/classing/naming that asp.net uses off...
By page source I mean once you build and view the page, you right click the page in your browser and chose "view page source" You get all the html code that MSVWD generated from the designer or whichever. It renamed my crap and the css wasnt taking, so I
had to work around it by using the names and stuff it generated.
I understand what you're saying. Since the CSS is applied to the DIV tag, the div tag does acctually showed up in the rendered HTML code but the Menu control was rendered as a table with all the links and texts showing inside of the table.
I'm at a loss then sorry. Mine doesn't go into a table, maybe because it's horizontal. I've gotten css formating on it but it wont center the way I want it either.
Recoding everything as php is starting to seem more appealing every day. They made ASP.Net sound so easy!
mychucky
Contributor
4358 Points
3709 Posts
Does Menu control take CSS from DIV tag?
Nov 17, 2010 01:06 PM|LINK
I have a Menu control on my page. I wonder if it takes the CSS from the DIV that it's in. So far, it does not seem like it is.
sansan
All-Star
53942 Points
8147 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 17, 2010 03:32 PM|LINK
If you haven't used the static menu item style and dynamic menu item styles for the menu control, parent Div css class should apply css styles like foreColor, Backcolor, font-weight and so on. If you set up Menu Styles, menu css will supersede the parent css class.
mychucky
Contributor
4358 Points
3709 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 17, 2010 03:41 PM|LINK
Thanks for the resonse. This is what I have.
<asp:Menu ID="mnuNav" runat="server" DataSourceID="smdsSiteMap" EnableViewState="false" CssClass="navMenu" OnMenuItemDataBound="mnuNav_MenuItemDataBound" Orientation="Vertical"> </asp:Menu>I want the "navMenu" of the Menu control to supersede its parent DIV but it does not look like it's doing anything. Just to test out, I tried this:
.navMenu { text-decoration: underline; line-height: 85%; padding-left: 25px; font-size: 11px; }Anyway, the padding-left does not work. It does not seem like the item is 25px from the left.
mychucky
Contributor
4358 Points
3709 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 19, 2010 02:19 PM|LINK
I think there is something wrong with the Menu control. Here's what I found out. If I use the HyperLink control then it displays exactly what I wanted. The styles from the CSS works like it should. However, if I put the Menu control back on, all the format from the CSS are gone. Any suggestion? In my example, I use the DIV tag with a CssClass and take the CssClass property out of the Menu control. Again, it works fine with HyperLink control though.
Any suggestion is much appreciated.
Ponos
Member
6 Points
7 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 19, 2010 03:40 PM|LINK
Have you checked what the element classed as in your page source? I've been playing with Menu's and CSS the last few days, and I noticed it will rename things somewhat weirdly.
For example I have my nav menu in a login view, and then in its div so it named it "#LoginViewID_DivID" and Classed it as the specified CssClass. But then for some reason it also classed all the links individually as "level1" which seems to override the CssClass set in your menu
I wish I could turn this auto-cssing/classing/naming that asp.net uses off...
mychucky
Contributor
4358 Points
3709 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 19, 2010 04:23 PM|LINK
This is what I have.
<div class="navMenu"> <asp:Menu ID="mnuNav" runat="server" DataSourceID="smdsSiteMap" EnableViewState="false" OnMenuItemDataBound="mnuNav_MenuItemDataBound" Orientation="Vertical"> </asp:Menu> <asp:SiteMapDataSource ID="smdsSiteMap" runat="server" SiteMapProvider="ClassNotesSiteMap" ShowStartingNode="false" /> </div>And CSS:
.navMenu { padding-left: 5px; font-size: 11px; margin-left:3px; line-height:180%; }Again, it works perfectly fine with HyperLink control though. I'm not sure. In the Menu control, line-height and padding-left are totally ignored.
Ponos
Member
6 Points
7 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 19, 2010 05:51 PM|LINK
By page source I mean once you build and view the page, you right click the page in your browser and chose "view page source" You get all the html code that MSVWD generated from the designer or whichever. It renamed my crap and the css wasnt taking, so I had to work around it by using the names and stuff it generated.
mychucky
Contributor
4358 Points
3709 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 19, 2010 06:31 PM|LINK
I understand what you're saying. Since the CSS is applied to the DIV tag, the div tag does acctually showed up in the rendered HTML code but the Menu control was rendered as a table with all the links and texts showing inside of the table.
Ponos
Member
6 Points
7 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 19, 2010 06:53 PM|LINK
I'm at a loss then sorry. Mine doesn't go into a table, maybe because it's horizontal. I've gotten css formating on it but it wont center the way I want it either.
Recoding everything as php is starting to seem more appealing every day. They made ASP.Net sound so easy!
mychucky
Contributor
4358 Points
3709 Posts
Re: Does Menu control take CSS from DIV tag?
Nov 19, 2010 07:00 PM|LINK
I may have to ditch Menu control since it does not work. It kept ignoring the CSS that's declared in the DIV tag.