Jump to content

Recommended Posts

Posted

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>

Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...