Center Middle the Aspx Content Page DIV based web page C# VB.Net

When browsing we found a lot of website in centered of the screen. The question is how developer doing this. In forums i found many times this question. Its simple and easy to middle the content for div based design. To do that wrap up all div in one div and then apply some CSS to middle or center the web page.

To Center The Web Page Use the Below CSS:

<style type="text/css">
    #main_container {width: 760px;margin:auto}

Now Design the DIV in below Format:

    <div id="main_container">
        <div id="content">
                <asp:ContentPlaceHolder ID="MainContent" runat="server"/>

Note: If you want to make whole website in center position then use the above code sample in “Site.master” page. Otherwise you can use in a specific page to achieve that.

Sample Output:

In my below code project i have used this code in “Site.master” page. Try to do same thing for individual pages if you want.

Download Code Example C#        Download Code Example VB.Net

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code