Satch3000 Satch3000 - 5 months ago 15x
HTML Question

Border Height on CSS

I have a table TD and on the right of it I want to add a 1 pixel border, so I've done this:

table td {
border-right:1px solid #000;

It works fine but the problem is that the border's height takes the total TD's height.

Is there a way to set the height of the border?


No, there isn't. The border will always be as tall as the element.

You can achieve the same effect by wrapping the contents of the cell in a <span>, and applying height/border styles to that. Or by drawing a short vertical line in an 1 pixel wide PNG which is the correct height, and applying it as a background to the cell:

background:url(line.png) bottom right no-repeat;