473,778 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:TableCel l BackColor="Blue Violet" ColumnSpan="2"
HorizontalAlign ="Center">
<asp:LoginVie w ID="LoginView2 " runat="server">
<AnonymousTempl ate></AnonymousTempla te>
<RoleGroups>
<asp:RoleGrou p Roles="Administ rator">
<ContentTemplat e>
<div style="text-align:left;
margin-left:auto; margin-right:auto;">
<asp:Menu ID="Menu1" runat="server"
SkinID="menu"
CssClass="menu"
DataSourceID="s mdsAdministrato r"
StaticDisplayLe vels="2"
Orientation="Ho rizontal">
</asp:Menu></div>

skin:<asp:menu runat="server"
SkinId="menu"
BackColor="#f0f 0f0"
ForeColor="#6B0 808"
StaticMenuItemS tyle-HorizontalPaddi ng="5px"
DynamicHoverSty le-BackColor="#6B0 808"
DynamicHoverSty le-ForeColor="#FFF FFF"
StaticSubMenuIn dent="10px"
DynamicMenuItem Style-HorizontalPaddi ng="5px"></asp:menu>
Sep 29 '08 #1
2 2800
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.NO SPAMwrote in message
news:Or******** ******@TK2MSFTN GP03.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:TableCel l BackColor="Blue Violet" ColumnSpan="2"
HorizontalAlign ="Center">
<asp:LoginVie w ID="LoginView2 " runat="server">
<AnonymousTempl ate></AnonymousTempla te>
<RoleGroups>
<asp:RoleGrou p Roles="Administ rator">
<ContentTemplat e>
<div style="text-align:left;
margin-left:auto; margin-right:auto;">
<asp:Menu ID="Menu1" runat="server"
SkinID="menu"
CssClass="menu"
DataSourceID="s mdsAdministrato r"
StaticDisplayLe vels="2"
Orientation="Ho rizontal">
</asp:Menu></div>

skin:<asp:menu runat="server"
SkinId="menu"
BackColor="#f0f 0f0"
ForeColor="#6B0 808"
StaticMenuItemS tyle-HorizontalPaddi ng="5px"
DynamicHoverSty le-BackColor="#6B0 808"
DynamicHoverSty le-ForeColor="#FFF FFF"
StaticSubMenuIn dent="10px"
DynamicMenuItem Style-HorizontalPaddi ng="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;margi n-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:TableCel l BackColor="Blue Violet" ColumnSpan="2"
HorizontalAlign ="Center">
<asp:LoginVie w ID="LoginView2 " runat="server">
<AnonymousTempl ate></AnonymousTempla te>
<RoleGroups>
<asp:RoleGrou p Roles="Administ rator">
<ContentTemplat e>
<div style="text-align:left;
margin-left:auto; margin-right:auto;">
<asp:Menu ID="Menu1" runat="server"
SkinID="menu"
CssClass="menu"
DataSourceID="s mdsAdministrato r"
StaticDisplayLe vels="2"
Orientation="Ho rizontal">
</asp:Menu></div>

skin:<asp:menu runat="server"
SkinId="menu"
BackColor="#f0f 0f0"
ForeColor="#6B0 808"
StaticMenuItemS tyle-HorizontalPaddi ng="5px"
DynamicHoverSty le-BackColor="#6B0 808"
DynamicHoverSty le-ForeColor="#FFF FFF"
StaticSubMenuIn dent="10px"
DynamicMenuItem Style-HorizontalPaddi ng="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
2291
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 standard. I am also using ColdFusion, but I having been using regular FORM tags instead of the proprietary CFFORM tags. If you can't put SELECT and INPUT tags inside of the FORM tag, where are you supposed to put them??? Take a look and tell me what...
15
3770
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 want to have a page that looks as follows: at the left, a blue column with a navigation menu. The rest of the page, with a white background, is for the content. The blue fades smoothly into the white. I managed to do this by using a background...
28
3436
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 added below each list item, that gets bigger for each subsequent item. Can someone please take a look and see if they can find my problem? It works almost perfectly in Firefox so you can see how it should look. It degrades
9
6256
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 attempts to use the following within the #header declaration: margin-left: auto; margin-right: auto; The image above the list is easily centred using the 'text-align' property,
3
6122
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 Opera7 (it works fine in Firefox). Any ideas as to why and what I might do to fix it? I've set up a little demonstration of the problem here: http://www.frostjedi.com/terra/dev/test.html It's set up to render in quirks mode to demonstrate that it...
3
1190
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 of attendence of students for each subject periods in a table with format like StudentName | Subject | AttendenceDate ABC | Math | 1/1/2005 ABC | Science | 1/1/2005
1
1325
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. I tried fiddling around with padding but that does not work because items are added to the menu at runntime and I can never know the width of the menu. Thanks for any ideas.
19
3695
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 code for this from a tutorial but that menu was flush-left justified. Not what I want. Subsequent searches on google on how to center yielded a
16
4937
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...
0
9629
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
9465
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10068
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
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
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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
3627
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.