Reputation: 25277
I have 2 columns, floated one to each side, and I'd like to use a 1px width line separator, that goes from top to bottom of the longest column.
Id rather stay away of TABLE layouts, and I dont know which one will be the longest column, or how long will it be.
How could I do this with just css?
Upvotes: 0
Views: 1169
Reputation: 4235
Something like this
.colright{
float: right;
border-left: 1px solid gray;
left: -1px;
position:relative;
}
Upvotes: 1
Reputation: 14534
This is possible with CSS. Here's my version of your example: http://jsfiddle.net/AhfXc/15/
Basically, just make the separator be absolutely positioned within the parent container (make the parent position relative so this works). Then attach the child to the top and bottom with top: 0 and bottom: 0. You could set the separator background to be the colour you want, but I've used a border style since you could easily apply dashed/dotted style if you want to.
This does only works if the columns have a known absolute or relative width because the separator's horizontal position is not directly affected by them, but if this is the case, it's a fairly simple solution.
Upvotes: 0
Reputation: 25455
You could fake it by putting a parent div
around both and giving the parent a background image which would be a 200px wide, 1px high image with the a 1px black/gray dot in the middle.
Upvotes: 0