October 21, 2012

Html CSS Using Margin

Introducing to you about using CSS Margin and applying our properties style in our html element. Our Margin it is define the space around the element or providing with an edge or border.

Margin in our html using CSS codes is the properties that we need to apply their styles to the border in our html element and the margin CSS are follows:

*Side margin (left or right)
*Top margin
*Bottom margin.



This CSS margin capable to adjust our border and align them as you like, so in this tutorial we are going to use the margin code using CSS,

Check our sample code that we are going to use below:


margin:10px; = This code are putting all side margin by 10 pixels.

margin:10px 20px; = In our property margin that having two values this is about from Top and bottom that give you value margin by 10 pixel and the left and right margin is 20 pixels.

margin:10px 20px 40px; = Property margin having three values, our Top margin is 10 pixel, Left and right margin 20 pixel and our Bottom margin is 40 pixel


margin:10px 20px 40px 60px; = Property margin four value by Top, Left /Right and bottom.

Our top is 10 pixel
Right is 20 pixel
Bottom is 40 pixel
and Left is 60 pixel.

Using margin code CSS

CSS Margin that we are going to use all the sides in our text content.

We are going to use 10 pixel for our margin text content.




If we look in our browser.


Our text to be 10 pixel in their side and check how we code it..


Margin with two values in our property margin.
Sample code: margin:10px 30px;




Checking in our browser:


Code in our margin that having two value code using CSS html


Property margin that having three (3) value in our text content sample code.
Sample code: margin:10px 30px 50px;




Browser check:


Tutorial of three value of our property margin this is gonna be look like if we use



Margin that having four(4) value in our content text page.
Sample code: margin:10px 30px 50px 60px;




Browser check


four (4) value for our Property margin and putting margin in our content pages.

How will if we putting margin using CSS intentionally?

To setting manually our margin by their each side we are going to add our code properties margin by putting this code.


  • margin-top
  • margin-right
  • margin-bottom
  • margin-left

Sample code: pick one in our property margin code above:

I will choose Margin-top.




If we see in our browser:

Sample that we are setting our margin intentionally .


So we are end for our codes margin CSS in our website, try it and explore your knowledge.


Next to Html CSS Using Padding Properties

No comments:

Post a Comment

Share Us

| Guideinfoyou (Guideline and Learning tactics) © 2008- 2014 w/blogger. All Rights Reserved | Designed by Virgil R. Toling Jr |