Loading
Hosting Unlimited Indonesia

Margins and Padding

Margins and Padding


For example, if you want a 10px margin all‐around, do this:
    margin: 10px;

If you want only the right and left to be 10px, it’ll look like this:
    margin: 0 10px 0 10px;

Remember that respectively just a little higher? As opposed to using four properties like:
    margin-top: 0px; 
    margin‐bottom: 5px; 
    margin-left: 10px; 
    margin-right: 15px;

You can do this instead, it’ll give the same result:
    margin: 0px 15px 5px 10px;

Always remember that when you use 4 values for the one property, it’s always in this order: top, right, bottom and left. In this example I used the margin property, but this applies to the padding property as well. That’s pretty much all there is on how to use margins and padding.

0 Comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Top WordPress Themes