I've spent an entire day wasting my time trying to figure out how to simply center an asp.net menu control in a web page.
I've tried centering in a div. No luck.
I've tried centering in a table column. No luck.
Oh, I've found lots of so-called answers with way-too complicated CSS styling by googling the problem, none of which worked for something that should be incredibly simple.
What is the deal?
So, I'll ask you all here before I completely give up and leave it looking lousy flush left on the page. Yuck.
How do I center an ASP.net menu control horizontally (not vertically) in a web page. I just want the menu displayed at the top of the page to be centered. I hope someone here can give me some real answers that actually work.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Thank you, but I don't see that you've applied the style to the menu or to a div surrounding it, which would make it much more helpful. Can you do that and show me? I'd appreciate it.
So, I've been struggling with this again for most of another day. I create divs, and the control doesn't appear inside of them. I create tables with a single row, and the control doesn't appear inside the table row. It's as though the menu control has
absolutely no clue about where it's being placed or what else is surrounding it. I am so frustrated! I hope someone can come up with something that actually works.
now you just need to adjust it as per your requirement.
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
I can see that your issue is solved now but you did not mark the answer.
as a result , this thread is still active and open.
I suggest you to mark the appropriate suggestion as an answer which helped you to solve the issue.
until you mark the answer, this thread will remain open.
so once you get the solution for your issue then try to mark the answer.
it will help other community members in future who will going to meet the issue like yours.
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
47 Posts
Why can't I horizontally center an asp.net menu control on a web page?
Aug 30, 2017 08:24 PM|klgrube|LINK
WOW.
I've spent an entire day wasting my time trying to figure out how to simply center an asp.net menu control in a web page.
I've tried centering in a div. No luck.
I've tried centering in a table column. No luck.
Oh, I've found lots of so-called answers with way-too complicated CSS styling by googling the problem, none of which worked for something that should be incredibly simple.
What is the deal?
So, I'll ask you all here before I completely give up and leave it looking lousy flush left on the page. Yuck.
How do I center an ASP.net menu control horizontally (not vertically) in a web page. I just want the menu displayed at the top of the page to be centered. I hope someone here can give me some real answers that actually work.
All-Star
50831 Points
9895 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Aug 31, 2017 02:49 AM|A2H|LINK
You could try with below code
Source URL
Aje
My Blog | Dotnet Funda
Contributor
2990 Points
1210 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Aug 31, 2017 07:45 AM|Deepak Panchal|LINK
Hi klgrube,
you can try this.
Output:
Regards
Deepak
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
47 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Sep 01, 2017 03:07 AM|klgrube|LINK
a2h,
Thank you, but I don't see that you've applied the style to the menu or to a div surrounding it, which would make it much more helpful. Can you do that and show me? I'd appreciate it.
Member
3 Points
47 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Sep 01, 2017 03:37 AM|klgrube|LINK
I'm sorry, Deepak, but I tried that techique and it didn't work. I don't know why. Here's my code . . .
I can't believe this is so awkward!
Karen
Member
3 Points
47 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Sep 01, 2017 03:41 AM|klgrube|LINK
So, I've been struggling with this again for most of another day. I create divs, and the control doesn't appear inside of them. I create tables with a single row, and the control doesn't appear inside the table row. It's as though the menu control has absolutely no clue about where it's being placed or what else is surrounding it. I am so frustrated! I hope someone can come up with something that actually works.
Karen
Contributor
2990 Points
1210 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Sep 01, 2017 06:22 AM|Deepak Panchal|LINK
Hi klgrube,
I try to check your code.
I find that there are some error in your code.
below is the corrected code:
also you need to set the margin :0 auto 0 auto.
Output:
now you just need to adjust it as per your requirement.
Regards
Deepak
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
47 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Sep 02, 2017 06:39 PM|klgrube|LINK
Thanks for your help, Deepak. I have this centering well now thanks to you.
Contributor
2990 Points
1210 Posts
Re: Why can't I horizontally center an asp.net menu control on a web page?
Sep 04, 2017 03:19 AM|Deepak Panchal|LINK
Hi klgrube,
I can see that your issue is solved now but you did not mark the answer.
as a result , this thread is still active and open.
I suggest you to mark the appropriate suggestion as an answer which helped you to solve the issue.
until you mark the answer, this thread will remain open.
so once you get the solution for your issue then try to mark the answer.
it will help other community members in future who will going to meet the issue like yours.
Regards
Deepak
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.