473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

problem horizontaly centering a menu on webpage

hi

asp.net 2.0

I wan thte menu to be horizontally centered on the webpage, but I want the
submenuitems to left aligned.
So I created a table cell with HorizontalAlign set to Center. With this
option set the menu was horizontaly centered as I wanted, except that also
submenuitems was centered too (not what I wanted). So then I tryed to add a
extra div around the menu (<div style="text-align:left; margin-left:auto;
margin-right:auto;">). But that didn't help either...

any suggestions?

Here is my markup:
<asp:TableCell BackColor="BlueViolet" ColumnSpan="2"
HorizontalAlign="Center">
<asp:LoginView ID="LoginView2" runat="server">
<AnonymousTemplate></AnonymousTemplate>
<RoleGroups>
<asp:RoleGroup Roles="Administrator">
<ContentTemplate>
<div style="text-align:left;
margin-left:auto; margin-right:auto;">
<asp:Menu ID="Menu1" runat="server"
SkinID="menu"
CssClass="menu"
DataSourceID="smdsAdministrator"
StaticDisplayLevels="2"
Orientation="Horizontal">
</asp:Menu></div>

skin:<asp:menu runat="server"
SkinId="menu"
BackColor="#f0f0f0"
ForeColor="#6B0808"
StaticMenuItemStyle-HorizontalPadding="5px"
DynamicHoverStyle-BackColor="#6B0808"
DynamicHoverStyle-ForeColor="#FFFFFF"
StaticSubMenuIndent="10px"
DynamicMenuItemStyle-HorizontalPadding="5px"></asp:menu>
Sep 29 '08 #1
2 2785
I find it easiest to use the CSS Friendly adapters
(http://www.codeplex.com/cssfriendly) and use CSS to set up the different
elements. You have much more control.

You can use CSS with the standard controls, as well, but it is not as easy.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:Or**************@TK2MSFTNGP03.phx.gbl...
hi

asp.net 2.0

I wan thte menu to be horizontally centered on the webpage, but I want the
submenuitems to left aligned.
So I created a table cell with HorizontalAlign set to Center. With this
option set the menu was horizontaly centered as I wanted, except that also
submenuitems was centered too (not what I wanted). So then I tryed to add
a extra div around the menu (<div style="text-align:left;
margin-left:auto; margin-right:auto;">). But that didn't help either...

any suggestions?

Here is my markup:
<asp:TableCell BackColor="BlueViolet" ColumnSpan="2"
HorizontalAlign="Center">
<asp:LoginView ID="LoginView2" runat="server">
<AnonymousTemplate></AnonymousTemplate>
<RoleGroups>
<asp:RoleGroup Roles="Administrator">
<ContentTemplate>
<div style="text-align:left;
margin-left:auto; margin-right:auto;">
<asp:Menu ID="Menu1" runat="server"
SkinID="menu"
CssClass="menu"
DataSourceID="smdsAdministrator"
StaticDisplayLevels="2"
Orientation="Horizontal">
</asp:Menu></div>

skin:<asp:menu runat="server"
SkinId="menu"
BackColor="#f0f0f0"
ForeColor="#6B0808"
StaticMenuItemStyle-HorizontalPadding="5px"
DynamicHoverStyle-BackColor="#6B0808"
DynamicHoverStyle-ForeColor="#FFFFFF"
StaticSubMenuIndent="10px"
DynamicMenuItemStyle-HorizontalPadding="5px"></asp:menu>
Sep 29 '08 #2
when you set the alignment of a div, you are setting the aligmnent of its
content, not the div. you probably wanted to center the div, and leave its
content left aligned. to center a div you set its margins:

<div style="margin-left:auto;margin-right:auto;">

-- bruce (sqlwork.com)
"Jeff" wrote:
hi

asp.net 2.0

I wan thte menu to be horizontally centered on the webpage, but I want the
submenuitems to left aligned.
So I created a table cell with HorizontalAlign set to Center. With this
option set the menu was horizontaly centered as I wanted, except that also
submenuitems was centered too (not what I wanted). So then I tryed to add a
extra div around the menu (<div style="text-align:left; margin-left:auto;
margin-right:auto;">). But that didn't help either...

any suggestions?

Here is my markup:
<asp:TableCell BackColor="BlueViolet" ColumnSpan="2"
HorizontalAlign="Center">
<asp:LoginView ID="LoginView2" runat="server">
<AnonymousTemplate></AnonymousTemplate>
<RoleGroups>
<asp:RoleGroup Roles="Administrator">
<ContentTemplate>
<div style="text-align:left;
margin-left:auto; margin-right:auto;">
<asp:Menu ID="Menu1" runat="server"
SkinID="menu"
CssClass="menu"
DataSourceID="smdsAdministrator"
StaticDisplayLevels="2"
Orientation="Horizontal">
</asp:Menu></div>

skin:<asp:menu runat="server"
SkinId="menu"
BackColor="#f0f0f0"
ForeColor="#6B0808"
StaticMenuItemStyle-HorizontalPadding="5px"
DynamicHoverStyle-BackColor="#6B0808"
DynamicHoverStyle-ForeColor="#FFFFFF"
StaticSubMenuIndent="10px"
DynamicMenuItemStyle-HorizontalPadding="5px"></asp:menu>
Sep 29 '08 #3

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

Similar topics

16
by: Dave | last post by:
Hello all, I'm getting a strange error when I try to validate my page(s). The error occurs when I use SELECT and INPUT tags inside of the FORM tag. I am trying to use the XHTML 1.0 Strict...
15
by: Garmt de Vries | last post by:
I would have guessed that this issue had been discussed to death, but I couldn't find an answer to my problem in the ciwas archives. So, at the risk of asking something trivial, here goes: I...
28
by: Lachlan Hunt | last post by:
Hi, I've been trying, but failing to work out what is causing Opera to render my drop down menu incorrectly on my site. http://www.lachy.id.au/ For some reason, there seems to be extra margin...
9
by: Faz | last post by:
Hi I'm having some real trouble with a header I have created within a container. I have two problems; firstly the menu (a horizontal UL) will not centre within the surrounding header, despite...
3
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and...
3
by: ramata | last post by:
I am woring on a project that involves a common but quite challanging and complex problem. I describe the scenario with a common example. School Attendence website: The school maintains records...
1
by: Uriah Piddle | last post by:
Hi Gang, I have a horizontal asp menu in a div. I centered the menu by setting the text-align prop of the div to 'center' and that works in IE. But with the other browsers, the menu aligns left....
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
16
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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...

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.