开发者

centre a website with masterpage?

开发者 https://www.devze.com 2023-03-05 21:07 出处:网络
I want to use a div to centre a website, 开发者_如何学JAVAshould this be done on the site.master or on each page?

I want to use a div to centre a website, 开发者_如何学JAVAshould this be done on the site.master or on each page?

thanks


<div id="wrapper">
  //Rest Of Masterpage
</div>

in CSS

#wrapper
{
    margin: auto;
}

This should center everythign in your masterpage


Add this CSS to your stylesheet

* { margin:0; padding:0; }
body { text-align:center; }
#container { width:960px; margin:0 auto; text-align:left; }

Then in the master page

<div id="container">

    <asp:ContentPlaceHolder ID="MainContent" runat="server"/>

</div>


<div>
<center>
<asp:ContentPlaceHolder ID="Content1" runat="server"/>
</center>
</div>


ASPX:

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

CSS:

#main { margin: 0 auto; }
0

精彩评论

暂无评论...
验证码 换一张
取 消