Adding Margins


Margin is the amount of space to be left around the top,bottom,left and right edge. By default, the HTML margins are set at approximately 10 pixels.


Why are margins used?

Please see the two images below. Which one would you prefer to read?

Obviously first one! Why? Just because it appears to be easy to read. When sentence is spread over entire screen you have to roll your eye balls all around making it difficult to read and comprehend. Margin, if left properly makes your website user friendly as well as concise.


We have four attributes to set the margins:
  • Leftmargin
  • Rightmargin
  • Topmargin
  • Bottommargin

These are used within the body tags.


Let us see how to set the desired margin!

<BODY LEFTMARGIN=”X” RIGHTMARGIN = “Y”>

This is the body of my page.

</BODY>

Replace X and Y with the desired pixels.

Also TOPMARGIN and BOTTOMMARGIN can be used in similar manner. See the video tutorial for details:


No comments:

Post a Comment