Code:
.box {
  width: 300px;
  height: 200px;
  padding: 10px;
  border: 1px solid #000;
  margin: 15px;
}From the image, you see that the margin is set to 15px.
- A margin is basically giving a bit of space that way it wont cover another part of your website or content. I usually set my margins for the container at "0" that way it will cover the entire body of the website. I then create DIVs for the content where I the decide if I would need to use margins to separate content.
- The border is set as decoration and can separate two items. I personally set my border on one side a lot of times to give that feeling of separation while terminating the use of a graphic.
- Padding is set to further move the content inside its parent container.
To see an example and get some HTML to work on this check out the Box Model I made here:
http://kgphojo.aisites.com/web_based_programing/week3/box.html
And if you still have more questions about the Box Model check out these links:
sitepoint.com
http://www.w3.org/TR/CSS2/box.html

 
No comments:
Post a Comment