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 trialG H Mahimaanvita
16,234 Pointspadding is outside the background color of the link
The padding property affects the space between text and the border and the color of that space is that of the background color of the element. But, when padding is applied to the link element in the list, a white space is created between the text and the border instead of tomato color. Why?
1 Answer
Steven Parker
231,236 PointsIf padding is applied to the link itself, I would expect the background color would also be extended. But if the padding is applied to the containing element, and that element has no background, then I would expect white space.
If that's not it, please show the actual code involved. To easily share your entire project, make a snapshot of your workspace and post the link to it here.
G H Mahimaanvita
16,234 Pointsoh, I get it now. I tried applying padding to the link and now its background color extended. But if I apply padding to the list item, it takes the background color of the list item, not the link. Here is the code:
a:link {
color: rgb(255, 169, 73);
text-decoration: none;
background-color: tomato;
padding: 10px;
}
li {
display: inline-block;
border-right: 2px grey solid;
padding: 0 12px;
margin: 80px 0;
}
Thanks for your help!!
Adomas Domeika
6,151 PointsAdomas Domeika
6,151 PointsPlease always show your code, because it might be a looot of things that is making something wrong..