Reputation: 2017
I have links with bottom border, in CSS like this:
a {
display: block;
width: 100%;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 30px;
border-bottom: 1px solid #EEE;
}
I have problem because the 'padding' value is getting added to the width value and border bottom is too long:
http://screenshooter.net/9186066/advygxa
Have you any idea?
Upvotes: 0
Views: 92
Reputation: 2597
It's working fine, check http://jsfiddle.net/GjMQe/
a {
display: block;
width: 100%;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 30px;
border-bottom: 1px solid #EEE;
}
Perhaps you forgot to include a reset.css file in your template.
Check Normalize.css
Upvotes: 0
Reputation: 18685
Add this to the div that contains the links.
overflow-x:hidden;
Demo: http://jsfiddle.net/calder12/zXmG3/
Upvotes: 0
Reputation: 46628
Padding and width have a hard time coexisting; simply remove your width declaration. Since your anchors are block, they will automatically take up 100% width (including padding):
a {
display: block;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 30px;
border-bottom: 1px solid #EEE;
}
Now it should take up a 100% width.
Upvotes: 3
Reputation: 7134
That's what padding does. Look at how the layout model works: adjust accordingly. If you're looking for a flexible solution then you need to remove the padding from the a
element and add something like an internal span
that has the proper margin within the a
and other dials adjusted accordingly.
Upvotes: 0