Why won't the container and header center on the screen?

I put together a very short file while trying to learn to code in CSS.  I'm baffled that the container won't center.
Here is the code...
<html>
<head>
<title>practice3</title>
<title></title>
<style>
body{background-color:#2c344f; text-align:center; font-family: "Arial"}
H2 { color:#963}
DIV {padding: 15px; margin: 5px; background-color:#f8f7ee}
IMG {margin:0 auto}
div#header {width:780px; text-align:center; background-color:#f8f7ee}
div#container{ text-align:center; width: 780px; margin: 0 auto}
</style>
<DIV ID="header"><img src="newbirdsonyellow.jpg" align="center" width="741">
</div>
</html>

Why place a separate wrapper div into the document...?
Short answer, better control.
Consider the following scenarios:
#1 I need to use 2 or 3 different background images on my page.  Until CSS3 gains better browser support, a  div can't have more than one background.
#2 I want my body to be 100% of viewport while my content is fixed-width and centered.
#3 If I use a fixed, centered background on my body, the background image slides off to the left when viewport is minimally resized.  Try it with the link below:
http://alt-web.com/DEMOS/fixed-background.shtml
#4 I have some APDivs in my layout.  To control them, I need to wrap them inside a relatively positioned division.  See disjointed rollover example:  http://alt-web.com/DEMOS/CSS-Disjointed-Image-Gallery.shtml
#5 I have some floated boxes in my content region. To control the space between them, I need to wrap them inside a fixed-width division that is smaller than my page. See CSS boxes example. http://alt-web.com/DEMOS/3-CSS-boxes.shtml
These a just a few situations in which having a #wrapper is better than not having one.  Your mileage may vary.
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media  Specialists
http://alt-web.com/
http://twitter.com/altweb

Similar Messages

  • When my screen goes to sleep and then the hard drive goes to sleep why won't the screen wake up?

    I can repeat this 100% of the time.  If I let the screen go to sleep (or I manually put it to sleep) and I shut the computer so the hard drive goes to sleep (or if the hard drive simply goes to sleep on the timer), when I open the Macbook Pro the screen will not wake up, although I think the hard drive does as the back light on the keyboard turns on.  Any ideas on why this is happening.  My computer is 4 weeks old...a bit frustrating.  The best answer I have gotten is get a new one for Apple...or completely re-install the OS.
    Jared

    The reason why it's happening is not obvious and can't be determined without more information. The fact that you can reproduce the problem makes it a lot more tractable.
    As a first step, boot in safe mode (shift key down at startup.) Can you reproduce the problem now? If so, note the time, then reboot as usual (not in safe mode) and look in the system log for error messages at the time the screen failed to wake up.

  • Start-up screen on ZEN; why won't the screen chan

    Hi everyone,
    I've just discovered in Mediasource that the start-up screen can be changed on the ZEN. However, when I change the start-up screen on Mediasource the start-up screen on the player doesn't change.
    I have followed all the requirements (60x04 bitmap, and the pic is black and white because the ZEN screen is monochrome).
    Any help would be greatly appreciated.

    I just took off my screen protector and it fixed my problem :).

  • Why won't the screen switch to enter password

    iPod turns on but I am locked out, I can take pictures but the pass code screen will not come up to enter pass code to play music

    Do you have the portrait orientation lock on? Double tap the home button, swipe to the right until you see a grey square icon with a circular arrow. Tap the icon until portrait orientation is unlocked.
    Message was edited by: The Huntress

  • Why won't the date and time stay in the menu bar?

    I just installed 10.6.2 and even when I use System Preferences to check the box in the Date/Time panel they flicker and disappear from the menu bar. Why won't the Date and Time stay in the Menu Bar? Any suggestions? Thanks.
    Frank B

    Doesn't any bring up the fact that Apple has so many customers with problems that the refuse to help unless you pay them cash? They update you and screw you over and then offer no useful troubleshooting scenarioius to help their millions of customers. It is because they want millions of our dollars. I hate Apple.

  • HT1657 Why won't the bought and downloaded films play?

    Why won't the bought and downloaded films play?

    It won't let me download iOS 7.  When I check for software updates it says that it is up to date.  I also went to iTunes to delete the songs from the iPod, but now it isn't even recognizing any devices.  I even uninstalled iTunes and reinstalled it to my computer.  LOL  I am sure it is something small, but I don't have the patience for it now.  Maybe I should step away from the computer and come back in a little bit...    Thank you for the advice though!  Keep it coming!  I know it is hard to diagnose over the internet, but any ideas help!

  • When I get the Please wait... message and have the latest Adobe update why won't the document open?

    When I get the Please wait... message and have the latest Adobe update why won't the document open?

    What is your operating system?  Reader version ("latest" means nothing)?
    Is this a local or only PDF?  If online, in what browser?

  • HT203164 Why won't the song titles transfer with the music when I burn to disc and play on another device?

    Why won't the song titles transfer with the music whaen I burn to disc and play or copy to another program?

    Thank you, reducing the image size worked! I had used a low res file before, and with success decided to increase the resolution/size, and then it didn't work. the image did appear in small preview in the export panel, but wouldn't burn when all was said and done. the dimensions you gave worked fine. unfortunately, it makes the image a little bit fuzzy, but i dont think i can do anything about this. at least it burned it in there. thanks!

  • I'm using firefox version 6 and for the last three days the add-ons manager page won't load. my question is why won't the add-ons page load? is the server down on your end?

    i'm using firefox version 6 and for the last three days the add-ons manager page won't load. my question is why won't the add-ons page load? is the server down on your end?

    Click on something below the Get Add-ons menu item on the left side of the Add-ons Manager tab.

  • I have a second generation ipod touch, why won't the ios 5 and ios 4.3 work on ipod touch 2g?

    I have a second generation ipod touch, why won't the ios 5 and ios 4.3 work on ipod touch 2g?

    Wel your "answer" provides not only a bad comparison, but is disingenuous at its heart!
    Apple sold a product (8GB iPod Touch) that one could have assumed to be 3rd generation at the time of purchase (because that was what all the other models of iPod Touch were at the time). Then when ios 4.3 came out, we who purchased one of these units found out that the 8GB Touch was really a 2nd generation model, and it would not ever be updated beyond ios 4.2.1 (8C148). Since the version (4.2.1) is BUGGY, it would be in the best interest of Apple to at least provide a bug-fix update release for these units. It is not like we are asking for all the new features of ios 4.3, just fix the BUGS, please, Apple!

  • TS1717 Why won't the preview song play for more than 10 seconds?

    Why won't the preview song play for more than 10 seconds?

    Perhaps try resetting your iTunes Store Cache.
    Go "Edit > Preferences". In the Advanced tab, click the "Reset cache" button shown in the following screenshot:
    ... and then click OK.
    Restart your iTunes, and head back to the Store. Are you getting full previews now?

  • HT1688 Why won't the volume on my iPhone 5 go down when I press the bottom volume up only works?

    Why won't the volume on my iPhone 5 go down

    Hey cacobo,
    I found an article that can help with troubleshooting an iPhone's receiver or speakers.
    iPhone: Can't hear through the receiver or speakers
    http://support.apple.com/kb/TS1630
    Verify that there is nothing plugged in to the headset jack, including headsets, headphones, or adapters.
    Make sure the Ring/Silent switch is not switched to silent.
    While on the Home screen, adjust the volume buttons. If you see the icon below, indicating that headphones are attached, there may be debris or an object lodged in the headset jack:
    Check the headset jack. If there is an object lodged in the headset jack that is not easily removed, have the iPhone serviced to remove object.
    For Original iPhone: If there is light debris, such as lint, in the headset jack, try connecting a pair of headphones to the headset jack and then remove the headphones. Repeat this several times to remove the debris.
    If you have installed a protective film on the display, either ensure that the receiver is not covered or remove the film completely.
    Check the receiver mesh (which is on the top front of the device, above the display). If it appears blocked, use a clean, small, dry, soft-bristled brush to carefully and gently brush away any debris.
    If you have paired with a Bluetooth headset that is nearby, either use the headset or turn Bluetooth off (chooseSettings > General > Bluetooth).
    Restart the iPhone.
    If restarting the iPhone doesn't resolve the issue, try restoring the device.
    If the issue persists, go to the Service Answer Center - iPhone for information on service.
    Hope that helps,
    David

  • In list view: Why don't searches include results from the Collections field? Why won't the Collections column sort properly?

    In list view: Why don't searches include results from the Collections field? Why won't the Collections column sort properly?

    I create a new index on column2, (INDEX_N3)
    and change SQL to
    select 1 from table T1 where
    T1.COLUMN_002 = '848K 36892'
    This time INDEX_N3 will be used.
    but change SQL to
    select 1 from table T1 where
    T1.COLUMN_002 = '848K 36892'
    and T1.COLUMN_004 = '1000'
    The explain plan will show full scan.
    Why?
    Thanks.

  • Why won't the images display in this flash widget?

    why won't the images display in this flash widget?
    http://www.coffeeandcandles.com/Wholesale_s/41.htm

    more info would help. If you're using actionscript and
    loading images from a folder maybe your path to that location is
    wrong. It's possible that your images aren't in the right layer or
    level but noticed that when initially published.

  • Why won't the audio book I purchased from itunes sync to my itouch?

    Why won't the audio book I purchases from itunes sync to my itouch?

    When I finish the sync and check the itouch, I can't find the books in the book section, though it appears in my library on the itunes website

Maybe you are looking for

  • Nano will not work properly in my car

    I have a 4th generation Nano. I just got a new car, and the car has a USB port to plug my Ipod directly into the car, and you can control the Ipod from the car's stereo. The problem is, into every single song I play, after a few seconds, or a minute

  • What are material movements

    hi,      i am from BI.. and i am creating a reports on production volumes.. in that i am nt able to get waht is material movements.. we have material movementa like 131/132...261/262....701/702...643/644...351/352...101/102...etc.. can u explain the

  • Who wants a game of  "spot the error"?!

    OK, this time I REALLY cannot see the error. The code is: <cfif #Form.RegCoID# NEQ "CoNotReg"> <cfquery name="getCoName" datasource="theatrepeeps"> SELECT CoName FROM CoID WHERE CoID = #Form.RegCoID# </cfquery> </cfif> <cfif #Form.RegVenueID# NEQ "Ve

  • Open Print Dialog using JavaScript

    Hi folks, I'm trying to open dynamically the print dialog window for printing the PDF (Ctrl + P) in WebDynpro ABAP using JavaScript. The JavaScript seems to be executed only for Interactive Forms, however I don't need to use interactive but only Prin

  • HT1222 URGENT - Security Update 2012-004 Server (Snow Leopard)

    Hi all After the above security upadate our clints can not upload any image in the web sites.... Any help are very well come Many Thanks