• RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Increase Website And Blog Traffic:latest article for Increasing Blog and website Traffic free gide.....
  • Create and Upload Site Map to Google:Google is fist largest Search Engine by upploading SITE MAP Google Easily Search Links from Ur site in Searching.......
  • Fix WEB SITE Errors:Google and other search engines always take those site in there fist page in searching which ha too less web Errors...
  • Top 20 Search Engine:Submit Ur site to top 20 Search Engines to Increasing Ur Site Traffic and making money top search engines like as Google, Yahoo, Ask, AOl, MSN...
  • Top Social Sites:Top 100 Social sites which real help U make a Affliate Marketer and in Pormoting ur Producdts...

New Posts

What is the difference between padding and margins?

Posted by Mohsin On 3/22/2014 04:28:00 AM 15 comments

For those who would like to know more about HTML and CSS, today we will see about the difference between margin and padding CSS properties which allow us to add blank space between the HTML elements, preventing the elements from getting 'stuck' together.

Although both possess similar functions, each has its particularity. 

  1. Padding determines the inner margins, being responsible for determining the distance between the content of a given element and its border.
  2. Margin is applied to the outside of an element affecting how far the element is away from other elements.
For more info, please take a look at the picture below:

padding and margin, css proprieties
Difference between margin and padding

Just as you have the option to define the borders for each side of your HTML elements (eg. borders in the sidebar), you can do the same with the margin and padding properties. All you need to to do is to change the top, right, bottom and left values​​.
These values ​​that you can select include: pixels (px), centimeters (cm), millimeters (mm). em units (em), x-height (ex), inches (in), picas (pc) and point sizes (pt).

By using margin and padding, you should add each value set in the four corners, as follows: top, right, bottom, left and each value must refer to each side of the HTML element. The first value is for the top, and they follow a clockwise direction, so the value would be close to the right, then bottom and finally, left.

Example 1: 

padding:5px 15px 5px 15px;
- top padding is 5px 
- right padding is 15px 
- bottom padding is 5px 
- left padding is 15px  

margin: 10px 5px 10px 5px;
- top margin is 10px
- right margin is 5px
- bottom margin is 10px
- left margin is 5px

If you define a single value, the distance applies to all sides, so it will be applied to the 4 sides of the HTML element that you want to modify.

Example 2:
padding: 5px (top and bottom) 15px (left and right);
margin: 10px (top and bottom) 5px (left and right);

If it helps to do it visually, think of an A4 page of type inside a picture frame. The margin is the space between the edge of the sheet of paper and the other elements (the parts of the frame) and the padding would be the space between the edge of the sheet and where the type starts on the page. The border would be the edge of the sheet of paper.

It's probably easier to understand if you have borders, then it also becomes obvious which one to use. Do you want the "space" after the border (outside the element = margin) or before the border (inside the element = padding).

15 comments:

Try to make one particular posture as natural as feasible.
Most of the horror stories you have heard about dating occur when daters rush
the process. Students will pick an issue within their
community.

my web site photography courses distance learning

Magazine cover - Students will choose a magazine, then study past cover photos
for inspiration. Take photos from the top of a hill, or off the side of
a yacht. The internet is the best and cheapest way to help you improve your
photographic skills.

Review my weblog; top ten photography schools

This is my first time go to see at here and i am really impressed to read all at one place.


Also visit my weblog - navarromqtk.soup.io ()

Why users still make use of to read news papers when in this technological world everything is accessible
on web?

My web page; peacevalleyperformancehorses.weebly.com ()

Please note that this is a 1 track recorder so any previous recording is
overwritten. Whitehill, Karen Jacobs, Iwaski and Michael
Khandros. Nikon Digital camera price in India is easy matches to the cost and quality sensitivity of the
crowd and relatively quite affordable.

my web site - short photography courses

confirm the gear over for damage, and order when it works.
Take photos from the top of a hill, or off the side of a yacht.

Of course, there are plenty of professionals who never attended a single class, so
it's up to you to decide what works best for your career.

My web-site :: photography schools in canada

Magazine cover - Students will choose a magazine, then study past cover photos for inspiration. Online courses also provide baby boomers the
chance to learn something new. "Next class we will begin learning about Impressionism.

my site - photography summer course

Pick just one museum such as the Rodin museum or L.
But what if you could get better grades with less study
time. Nikon Digital camera price in India is easy matches to the
cost and quality sensitivity of the crowd and relatively quite
affordable.

my web page: good online photography courses

confirm the gear over for damage, and order when it works.
Whitehill, Karen Jacobs, Iwaski and Michael Khandros.

Usually, there is little room for extras, as the typical dorm room just isn't large enough, so it's important to be as creative as
possible.

Also visit my web site ... school courses online

I have taken quite a few of these workshops, and have been quite pleased with all of them.

But what if you could get better grades with less study time.

The best dance school in Boulder can provide a comprehensive lesson on basic dance steps and movements.


My webpage ... online course photography

View other Seattle Free Stuff articles or visit Cindy's blog at
for frugal tips, free stuff and advice on saving money. Most of the horror
stories you have heard about dating occur when daters rush
the process. The best dance school in Boulder can provide a comprehensive lesson on basic dance steps and movements.


my site ... photography classes for teenagers

Padding and margins are the important segment in CSS to make the correct alignment in website designing.
Web Development Company Bangalore | Website Design Company Bangalore

I look for something that feels very happy and formations

There are lots of information about latest technology .But this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies. By the way you are running a great blog. Thanks for sharing this


Dot Net training in chennai

This blog is having the general information. Got a creative work and this is very different one. We have to develop our creativity mind. This blog helps for this. Thank you for this blog. this is very interesting and useful.
Digital Marketing Company in Chennai

Post a Comment

All types of Comments are welcome