Centering a Panel on a page

Last post 03-26-2007 3:00 PM by mgbeers. 4 replies.

Sort Posts:

  • Centering a Panel on a page

    03-26-2007, 12:54 PM
    • Loading...
    • mgbeers
    • Joined on 02-13-2007, 11:16 AM
    • Posts 4

    What is the best way to get a panel centered on a page?  I am trying, and for the life of me, I cannot get it to work via CSS or properties...etc.  I'm trying to design the web master page, and its not working.  I'm a straight CSS and HTML guy whose only been using asp for about a year and now doing asp.net.  Please help even if you only have some good links to tutorials, I'd appreciate it!  Thank you in advance,

    Matt 

  • Re: Centering a Panel on a page

    03-26-2007, 1:13 PM
    • Loading...
    • Fredrik N
    • Joined on 06-22-2002, 1:03 AM
    • Sweden
    • Posts 5,333
    • Moderator
      TrustedFriends-MVPs

    I often use a table with the with 100% and height 100%. Then I make sure the <td> is alinged to the center.

    Some people don't like tables and instead uses <div>, but I'm not one of them, yet ;)

    you can also specify absolute position of elemetns by using CSS, but I try to avoid it as much as possible.

    /Fredrik Normén NSQUARED2
    Microsoft MVP, MCSD, MCAD, MCT

    ASPInsiders
    My Blog, ASP.Net 2.0 etc

    Cornerstone AB
  • Re: Centering a Panel on a page

    03-26-2007, 1:45 PM
    • Loading...
    • mgbeers
    • Joined on 02-13-2007, 11:16 AM
    • Posts 4
    Thank you, I do know how to align and position tables within a panel when I need to.  The problem I am having is finding the method to create the web page, the inconsistencies with asp.net 2.0 are "hair pulling" frustrating.  I've got a master page that was created entirely with CSS positioning using DIVs already.  I'm trying to figure out how to use panels and what their advantages are over other methods if there are any.  I read that they were rendered as divs in IE anyway... and tables in mozilla.  Since we are an IE only shop (intranet) I decided to try using panels.  It doesn't seem like standard CSS is accessible from the panels.  Position: Relative or absolute, margins set to auto.. none of this is working..
  • Re: Centering a Panel on a page

    03-26-2007, 1:52 PM
    • Loading...
    • Fredrik N
    • Joined on 06-22-2002, 1:03 AM
    • Sweden
    • Posts 5,333
    • Moderator
      TrustedFriends-MVPs

    Aha, I see.. but can't you use <div>s and add your Panel into the div that will be in the middle instead, that is how I should have done it... but I don't use Panels so often.. I only use it when I don't want to use a PlaceHolder when I need to add my control dynamically to the page.

    /Fredrik Normén NSQUARED2
    Microsoft MVP, MCSD, MCAD, MCT

    ASPInsiders
    My Blog, ASP.Net 2.0 etc

    Cornerstone AB
  • Re: Centering a Panel on a page

    03-26-2007, 3:00 PM
    • Loading...
    • mgbeers
    • Joined on 02-13-2007, 11:16 AM
    • Posts 4

    The only reason I was going with panels is to see if they were a viable replacement for standard css.  My colleague and I were under the impression that some of the unexpected results we've been getting have been due to standard css rather than using controls and their properties.  So perhaps that's not true?  Thank you, by the way for the prompt responses. 

    One of the problems we've had has been to remove the ugly gray background from some of the controls.  For some reason we have not been able to do so and that's what's brought us to this point.  Maybe you have an answer to that? 
     

Page 1 of 1 (5 items)
Microsoft Communities
Page view counter