Solved Need help about "PADDING" in CSS

Status
Not open for further replies.

mr.lashpash

New Member
Thread author
Oct 18, 2012
58
Hi i am trying to learn XHTML alongwith CSS and there is little confusion about PADDING.
Could anyone explain this or tell me what are core rules of this
Thanks
 

iPanik

New Member
Feb 28, 2011
530
Padding is used to make an element bigger than it's content.
For example, if you have a div with text in it and you want to give it a background color but the background should be bigger than the text.

HtLNH.png


In this case you would put padding on the div and the element will become bigger.

BzfQ6.png


Another example is if you have an image with a border. If you don't want the border to hit the image you can give some padding the the image and this will push the border in the specified direction.

Padding is really useful if the content is dynamic, meaning that the length of the text (or whatever is within an element) can vary. Padding doesn't care how big the element is and will enlarge it no matter what.

Hope that made any kind of sense :)
 
Upvote 0

imsoadude

Level 3
Verified
Feb 21, 2011
838
you can also look on the w3 website if your having trouble with syntax ( http://www.w3schools.com/css/css_padding.asp )
 
Upvote 0
Status
Not open for further replies.

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top