nmm Posted October 10, 2011 Report Share Posted October 10, 2011 Hello, i am very new to this so this is my question. why is the border around the whole page instead of where my margins are. I am readindg a book and typed everything exactly the way the book was. any way here's the code. thank you for taking a look. <html> <head> <title>Starbuzz Coffee</title> <style> body{ background-color: tan; margin-left: 300px; margin-right: 300px; padding: 10px 10px 10px 10px; font-family: sans-serif; border: 2px solid black } </style> </head> <body> </body> </hmtl> Quote Link to comment Share on other sites More sharing options...
Wickham Posted October 10, 2011 Report Share Posted October 10, 2011 The body is normally the whole screen area, so the background is for the whole window and margins appear around the window sides. The border and padding appear inside the margins, so with your code the border appears 300px from the left and right sides and padding inside the borders. It's more normal to have only a background and margins to the body style, then use a page wrapper div for all your content which can have width, height, padding and borders. It would be a good idea to add a doctype from here:- http://www.w3.org/QA/2002/04/valid-dtd-list.html We generally recommend the HTML 4.01 Strict doctype on this forum. Quote Link to comment Share on other sites More sharing options...
nmm Posted October 11, 2011 Author Report Share Posted October 11, 2011 Thank you for taking the time to look at this for me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.