Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix 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 April 5th, 2013, 05:45 PM
Authorized User
 
Join Date: Mar 2013
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default How does the page centre from Chapter 3 code

Hi

The css controls how the web-pages position. Can anyone say how the header, navigation and content centre in the middle please. This is the .css code :-
Code:
/*
-------------------------------------------------
HTML ELEMENTS
-------------------------------------------------
*/
body {
    font-family : Verdana, Helvetica, sans-serif;
    font-size: 80%;
    color: #5f5f5f;
    padding: 0;
    margin: 0;
    background-color: white;
}

/*
-------------------------------------------------
SITE STRUCTURE
-------------------------------------------------
*/

#header, #navstrip{
    width: 100%;
    background-color: #4b4b4b;
}

#header{
    min-height: 70px;
    color: white;
}
#navstrip{
    border-bottom: 2px solid #c3c4c8;
}
#head, #nav, #wrapper{
    width: 900px;
    margin: auto;
}
#head{
    font: normal 4em Tahoma;
    line-height: 2em;
}
#wrapper{
    background-color: white;
    border: 2px solid #717171;
}
#nav{
    background-color: #717171;
    line-height: 25px;
    color: white;
}

#nav a, #nav a:hover, #nav a:visited{
    color: white;
    font-size: 1.0em;
    text-decoration: none;
    text-transform: uppercase;
    padding: 5px 15px;
}
#left, #content{
    float: left;
    min-height: 400px;
}

#left{
    width: 180px;
    background-color: #e8e8e8;
}

#content{
    width: 700px;
    background-color: white;
    padding: 10px
}

#footer{
    clear: both;
    font-size: 90%;
    color: #999;
    text-align: center;
}

#nav, #login {
    border-bottom: 1px solid black;
    padding-bottom: 4px;
}
 
Old April 5th, 2013, 06:01 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That's done with this:

width: 900px;
margin: auto;

This sets the width to 900px. The remaining space is then divided with margin: auto which divides the remaining space equally between the left and right sides.

Cheers,

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:
999csharp (April 6th, 2013)
 
Old April 6th, 2013, 09:01 AM
Authorized User
 
Join Date: Mar 2013
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks Imar. Theres so much more I need to learn to create a web-site. Thanks for helping me so much.
Cheers
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9: Page 63. How to write the code in C# ? niladri BOOK: Knight's 24-Hour Trainer: Microsoft SQL Server 2008 Integration Services 2 August 17th, 2014 06:44 PM
Chapter 14 Code page 620. Please help. mike2012 BOOK: Beginning ASP 3.0 1 January 21st, 2014 06:20 AM
Chapter 5 ToDoList example code page 168 docuk BOOK: Professional Android 2 Application Development 0 December 3rd, 2011 04:08 PM
Chapter 4 Page 118 code PhoenixInc BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 January 15th, 2008 08:58 PM
Error in code Chapter 13 Page 516 neubauet BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 9 June 11th, 2006 11:06 AM





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