Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 24th, 2011, 12:30 PM
Authorized User
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default Centering the site

Hi all, just started the book and looks good but have a question about the sample ASP site that you create when creating your first site:

What makes the page remain centred when resizing the IE window, and not left justified? I can't see a centred declaration in the form or CSS code.
 
Old January 24th, 2011, 12:42 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

That's done with this rule in the CSS file:

.page
{
width: 960px;
background-color: #fff;
margin: 20px auto 0px auto;
border: 1px solid #496077;
}

The width property gives the main content div (with a class of page) a fixed width of 960 pixels. The margin attribute then sets the left and right margin of that div to "auto" which equally divides the remaining space between the left and right edges.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
AlexW (January 24th, 2011)
 
Old January 24th, 2011, 01:23 PM
Authorized User
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Brilliant, thanks for your quick reply.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help centering DIV in CSS appstate98 BOOK Beginning CSS: Cascading Style Sheets for Web Design, 2nd Ed; ISBN: 978-0-470-09697-0 3 September 12th, 2009 11:54 AM
Centering content Europom CSS Cascading Style Sheets 2 February 18th, 2008 06:25 AM
Centering a box Terry Joseph Migliorino CSS Cascading Style Sheets 3 December 28th, 2005 09:22 AM
Not centering tul CSS Cascading Style Sheets 3 September 22nd, 2005 12:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.