Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSahar Nasiri
7,454 PointsPercentage size of paddings
I didn't understand the differences between percentage size and pixel size of the paddings!
2 Answers
Huseyin INAN
170 PointsOpps my html answer was striped by system software.
You can see what I say on https://css-tricks.com/forums/topic/responsive-web-design-when-to-use-px-vs-on-margins-and-padding/
Generally, I use bootstrap or materializecss for responsive web sites. If you like it, can use them.
Huseyin INAN
170 PointsGenerally you will use pixel size for paddings. But, if you use percentage, your element padding will be flexible according to parent element.
Example: (paddings will be 10px) <div style="width: 100px; height: 100px"> <div style="width: 90px; height: 90px; padding:10px">Content</div> </div>
Example: (paddings will be 5px) <div style="width: 100px; height: 100px"> <div style="width: 90px; height: 90px; padding:5%">Content</div> </div>
Example: (paddings will be 10px) <div style="width: 200px; height: 200px"> <div style="width: 90px; height: 90px; padding:5%">Content</div> </div>
Sahar Nasiri
7,454 PointsThank you :) But can you tell me how can I see the difference operated on my page? Because when I resize the page both operating similarly.