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 September 19th, 2011, 05:10 PM
Authorized User
 
Join Date: Sep 2011
Posts: 37
Thanks: 13
Thanked 0 Times in 0 Posts
Send a message via MSN to SamuelMSr
Default Formatting CSS to center Monochrome CSS

I am currently on chapter 9, page 313 and working forward.

One thing that has continued to bother me that I can not figure out is the site that was created by the author, when using the Monochrome theme is centered on the screen.

Mine is not, it is all on the left edge of the screen (you can see this where I have been uploading my site www.samuelmsr.com)

I have gone all over the downloaded CSS pages and other code trying to figure out where my problem is, and have had no luck.

Please tell me what you would like me to post other then the CSS information i will paste below. Thanks for any help!

Code:
*
{
  /* 
    Defines the main font used throughout the entire site 
  */
  font-family: Arial, Sans-Serif;
}

body
{
  /* 
    Clears white space around the body and gives it a dark gray color.
  */
  margin: 0;
  background-color: #cccccc;
}

a
{
  /*
    Clears the underline on normal links, and gives them a purple text color.
  */
  text-decoration: none;
  color: #4628C4;
}

a:hover
{
  /*
    Underlines links when the user hovers the mouse over them.
  */
  text-decoration : underline;
}

h1
{
  /*
    Makes h1 elements smaller than their browser default.
  */
  font-size : 20px;
}

h2
{
  /* 
    Gives h2 elements a different background color and size, 
    and adds a bit of margin at the top to create room between the heading and the preceding element.
  */
  font-size : 14px;
  color : #7773A1;
  margin-top : 10px;
}

#PageWrapper
{
  /*
    Sets the total width for the entire page. Also sets the background-color
    which is used to fill the background of the Sidebar in case the MainContent block is taller than the Sidebar.
    Uses margin: auto to center the entire page in the middle of the browser's window.
  */
  width: 844px;
  margin: auto;
  background-color: #7773A1;
}

#Header
{
  /*
    Gives the header the same width as the PageWrapper. The height creates some room for the logo
    that is set with the background-image.
  */
  background-image: url(Images/Header.jpg);
  width: 844px;
  height: 86px;
}

#Header a
{
  /*
    The #Header a is a link nested in #Header. It provides a link back to the homepage.
    The size of the link is the same as the header, so the entire header is clickable.
  */
  width: 844px; 
  height: 86px; 
  display: block;  
}

#MenuWrapper
{
  /*
    The menu spans the page width, right below the header.
    At the top and left a few pixels padding is applied to create some room.
  */
  background-image: url(Images/MenuBackground.jpg);
  width: 827px;
  height: 36px;
  padding-top: 7px;
  padding-left: 17px;
}

#MenuWrapper a
{
  /*
    Links in the Menu are white. This gets overriden by styles in chapter 7.
  */
  color: #FFFFFF;
}

.MainMenu
{
  /*
    The Menu gets a white border on all four sides.
  */
  border: 1px solid white;
  width: 814px;
  height: 19px;
  background-color : #cccccc;
}

.MainMenu ul li
{
  /*
    Gives the four menu items in the main menu a width of 200px each
  */
  width: 200px;
}

#MainContent
{
  /*
    Defines the main content area. The #MainContent element has a minimum height of 500 pixels, but can grow if necessary.
    The font-size is 80% of its parent element, which in this case comes down to 80% of the font
    the user has specified as the default font in the browser.
  */
  font-size: 0.8em;
  width: 659px;
  border-left: 1px solid white;
  border-right: 2px solid white;
  float: left;
  background-color: #e1e1e1;
  min-height: 500px;
  padding: 10px;
}

#Sidebar
{
  /*
    The Sidebar is positioned to the right of the MainContent area. It gets the same font-size as #MainContent
    and gets a background image called Sidebar.jpg. To ensure the image is visible in (most) browsers
    on a small page, the element gets a minimum height of 500px. This is ignored by IE 6.
  */
  font-size: 0.8em;
  color: White;
  background-image: url(Images/Sidebar.jpg);
  background-repeat: no-repeat;
  background-color: #7773A1;
  width: 142px;
  min-height: 500px;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 20px;
  float: left;
}

#Footer
{
  /*
    The footer is positioned below all other content (yet still within PageWrapper).
    clear: both is used to clear the impact of the float properties used for #MainContent and #Sidebar.
  */
  width: 844px;
  clear: both;
  height: 37px;
  background-color : #BCD1FE;
  color: White;
  text-align: center;
  font-size: 0.7em;
  font-weight: bold;
  line-height: 37px;
}

.Introduction
{
  font-style: italic;
  color: #3e3e3e;
}

.MyButton
{
  color: White;
}

ul.level1
{
    font-size: 14 px;
    font-weight: bold;
    height: 19px;
    line-height: 19px;
}

ul.level1 .selected
{
    background-color: #BCD1FE;
}

a.level1
{
    margin-left: 5px;
}

a.level2
{
    background-color: #cccccc;
    padding-left: 8px;
}

a.level1:hover, a.level2:hover
{
    background-color: #BCD1FE;
}

img
{
    border: 0;
}

.ErrorMessage
{
    color: Red;
}
 
Old September 20th, 2011, 03:39 AM
Registered User
 
Join Date: Aug 2011
Posts: 13
Thanks: 0
Thanked 5 Times in 5 Posts
Default

The problem is the way "PageWrapper" is spelled. In your CSS file it is "PageWrapper" and in the HTML file it is "Pagewrapper" (i.e. one W is uppercase and the other is lowercase).

CSS is case-sensitive, so you need to make the cases match and then the page will be centred.
The Following User Says Thank You to mmmason For This Useful Post:
SamuelMSr (September 20th, 2011)
 
Old September 20th, 2011, 03:50 AM
Authorized User
 
Join Date: Sep 2011
Posts: 37
Thanks: 13
Thanked 0 Times in 0 Posts
Send a message via MSN to SamuelMSr
Default

Quote:
Originally Posted by mmmason View Post
The problem is the way "PageWrapper" is spelled. In your CSS file it is "PageWrapper" and in the HTML file it is "Pagewrapper" (i.e. one W is uppercase and the other is lowercase).

CSS is case-sensitive, so you need to make the cases match and then the page will be centred.
Thank you very much for that!

In all this learning I am doing, my biggest failure is my spelling and grammer. Also getting in the habit of when to use uppercase and lowercase.

I have spent so many of the last 13 years gaming (MMORPGS) that I am used to letting my fingers fly and hitting enter, regardless of the jumbled mess I may or may not have just typed :)

Have a great day/night (wherever you are) :D





Similar Threads
Thread Thread Starter Forum Replies Last Post
monochrome and darkgrey css whenning BOOK: Beginning ASP.NET 4 : in C# and VB 2 May 14th, 2011 06:49 AM
page 221 - problems with Monochrome and dark grey css sarala BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 April 16th, 2010 02:35 AM
Formatting php with css Hylsan Pro PHP 3 December 25th, 2006 07:16 AM
CSS formatting LoneStar1 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 April 10th, 2006 09:16 AM
align="center" in CSS crmpicco CSS Cascading Style Sheets 5 February 21st, 2006 09:31 AM





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