172
rated 0 times
[
177]
[
5]
/ answers: 1 / hits: 45786
/ 12 Years ago, sun, december 9, 2012, 12:00:00
I'd like to use the CSS border
attribute to make a fine 1px
grid between span
elements, like so.
|
1 | 2
-----|-----
3 | 4
|
This is what I currently have. It doesn't quite work obviously.
<html>
<head>
<style>
div {
width: 204px;
}
span {
display: inline-block;
height: 100px;
width: 100px;
border: 1px solid #ccc;
border-left-width: 0;
border-top-width: 0;
}
</style>
</head>
<body>
<div><span>1</span><span>2</span><span>3</span><span>4</span></div>
</body>
</html>
When the div
is set to 306px
and the elements reflow, the solution should adapt dynamically.
| |
1 | 2 | 3
-----|-----|-----
4 |
|
Preferably CSS only, or pure Javascript. Older browsers like IE7 can be ignored.
More From » html