I have always the same problem, when I have 2 adjacent elements with borders, the borders are merged. With tables we have the border-collapse property for solving this.
I've tried omiting the border from one of the sides, but that works only for elements in the middle, the first and final element will miss a border.
Does somebody know a solution for list elements for example?
border-collapse: collapse | separate; Initial value: separate. Applies to: table and inline-table elements. Inherited: yes.
In the separated model, adjacent cells each have their own distinct borders. In the collapsed model, adjacent table cells share borders. The border-spacing CSS property specifies the distance between the borders of adjacent table cells (only for the separated borders model).
The border-collapse property sets whether table borders should collapse into a single border or be separated as in standard HTML.
Set the CSS border Property to none to Remove Border From a Table in HTML. We can set the border property to none to remove the border from an HTML table. The property is short-hand of different border properties. Those different properties are border-width , border-style and border-color .
Here's how I solved it: add a margin-left/-top of -1px to each li element. Then the borders really collapse without any tricks.
You can add a left and bottom border to the ul and drop it from the li.
fiddle: http://jsfiddle.net/TELK7/
html:
<ul> <li>one</li> <li>two</li> </ul>
css:
ul{ border: 0 solid silver; border-width: 0 0 1px 1px; } li{ border: 0 solid silver; border-width: 1px 1px 0 0; padding:.5em; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With