Jump to content
Killersites Forums

Margins


nmm
 Share

Recommended Posts

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...