8
I have a grid created with a list ul
whose internal elements to li
contains a border.
The idea is that when the elements are side by side the edges are manipulated so that only a single stroke with 1 pixel is left instead of what happens:
Problem
As the list should be at a width of 100% of the area where it is inserted and its elements li
should stick to 25% of the width of the list, the gray border is applied on the link a
within each li
so as to prevent the 25% width plus the 2 pixels that the edge (1px right edge + 1px left edge) occupies break the layout:
HTML
<ul>
<li>
<a href="#" title="">1</a>
</li>
<li>
<a href="#" title="">2</a>
</li>
<li>
<a href="#" title="">3</a>
</li>
<li>
<a href="#" title="">4</a>
</li>
<li>
<a href="#" title="">5</a>
</li>
<li>
<a href="#" title="">6</a>
</li>
<li>
<a href="#" title="">7</a>
</li>
<li>
<a href="#" title="">8</a>
</li>
</ul>
CSS
ul, li, a{
display:block;
margin:0;
padding:0;
}
ul{
width:100%;
}
li{
float:left;
width:25%;
}
a{
border:1px solid #c9c7c7;
text-align:center;
height:200px;
}
Question
How to make the final result of the grey edges look like the bottom ?
The number of squares is fixed or dynamic?
– Kenny Rafael
@Kennyrafael The grid is as presented, but in the future more rows may be needed! Columns will always be four.
– Zuul
And this content is generated with PHP?
– Kenny Rafael
What is the content of this? Use a table with
border-collapse
would be out of the question for semantic reasons?– bfavaretto
@bfavaretto Out of the question because of the animations via jQuery that will be applied, otherwise there was already a table :)
– Zuul
@Zuul, this content is generated manually or via PHP or other language?
– Kenny Rafael
@Kennyrafael PHP, but if possible I prefer to run away from a solution that is dependent on the "generator" of the list.
– Zuul