This is a table made out of divs. I'm not sure quite why people might want this, but someone did ask how it could be done, so...
Here's the code :
HTML
<div id="dwrap">
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
<div>HELLO</div>
</div>
CSS
#dwrap div {
width: 100px;
height: 100px;
border: 1px solid #FF00FF;
float: left;
}
You could change the size of the boxes or the number of boxes per row quite easily and if you add 'overflow: auto' to the style, you could have twelve scrolling boxes - like this :
Here, I've listed some of the Tranmere Rovers Football Club squad as an example, but it could be quite good for something useful (though I'm not quite sure what).
Now I'm curious... What kind of thing did you do with this idea? Could you post a link to your page?
Thanks.
Yes, you did... Thanks for sharing that with me.
Now, I'd recommend removing the xml prologue and adding a meta tag with the character set.
Hey. nice layout, I shall make fine use of it
ane alteration I will make is to remove the double-border effect (the inner borders look darker than the outer ones). This is achievable by making use of the following CSS (for a black border)
border-bottom: solid 1px black;
border-top: solid 1px black;
border-left: solid 1px black;
border-right: solid 1px black;
all you need to do is add the appropriate css to the right table cells and you wont have the double-border effect.
all you need to do is add the appropriate css to the right table cells and you wont have the double-border effect.
Yes, good point.
I don't understand the usage of the floats in this case... Won't it work without?
No, it won't work without the floats.
i found a simpler solution to the double-border issue.
just use:
table {
border-collapse: collapse; }
td {
border: 1px solid #333; }
How would you manage to do more advanced tables, like columns with different widths?
-Jay
Well, maybe that's where it falls apart. What are you trying to do exactly? It's probably better to do it another way.
Thank you BonRouge. Nice clue! I have used it to compose the top stripe with pictures in
this page.
I'm a bit of a newbie to all this code and I really want to know, can you change the colours of the scrollbar in a div...thing *cringe*?
Hey. It's quite easy to change scrollbar colors.
<style>
scrollbar-face-color: 0099FF;
scrollbar-highlight-color: 000000;
scrollbar-3dlight-color: FFFF00;
scrollbar-shadow-color: 000000;
scrollbar-darkshadow-color: CC33FF;
scrollbar-arrow-color: 000000;
scrollbar-track-color: 000000;}
</style>
I cant seem to figure out a way to have all of the Divs centered on the page as well. I have made my table out of divs (each with a picture and subtitle) but I cant get the whole table to be centered on the page? any ideas? (I want to keep the dynamic aspect of it that it can change dimensions with the width of the page)
How does it know it has to use 4 elements per row?
Carrie,
Good browsers don't support the scrollbar colour code.
Jerry,
You could maybe use a percentage width for the #dwrap and also percentages for each of the inner divs.
tinny,
It uses four elements per row due to the width of each element and the width of this column here. This column is just over 400px wide (I think) and each box is set to be 100px wide. The elements float to the left, making a row across the column, when there is no room for one more little box, the next element goes below the row. I hope that makes sense.
Yeah, I seen this before. But your missing one, very difficult piece.
This page has three columns (menu, content, google ads). Lets see you make the center column stretch to meet the users screen width while the two outsides columns remain a fixed width. When that is done lets see if these "table made out of divs" in the center column still layout correctly. They will not. Harder yet put both text and pics together in these tables.
Yet this can be done with the old table method.
Would like to know if my yesterday's comment has been received.
good one ...can make a simple and nice calendar with this.. ;)
good one ...can make a simple and nice calendar with this.. ;)
http://www.ashisoft.com
This is perfect for a data repeater control that I am using for my asp.net page. Much easier to produce this than with the tr and td tags. Thanks!
thanks for this layout, as Chi said it is perfect for repeating data. I'm currently using it to set up a form. I will be back to send a link of the site when its done thanks for the code, I did not think this was so east to do in CSS.
Well When I try to use it in my site it fucks everything up! But as soon as I disable my pager wrapper it kind of works except that it still fucks my entire design up. soz about the fuck word but it is the only one that can describe what is happening to my design
Thanks.
But FLOAT not need in this case.
Nice Code, Working fine..
Thanks
Cheers for the code Is it possible to vertically align the text fields in each of the div's so they align in the center vertically than at the top? Thanks
Cool
nice... but tell us more about it.
hello sir
in css i just add a 5px width1000 px height div without any margin,but there seems a margin in top and bottom of the div how could i remove that..please advise
but what if the content of the is alot more for some cells, I believe it would not look so neat still?
I am having the same problem as tinny how do i put it in code to tell the divs to go in horizontal line not vertical whenever i put something in a webpage it wants to go down the page not across
hello,
i found this one very helpfully.it really solve my problem which i face from few days
thank you
hello,
Found this very useful.
Thank You
thank you
Why do people need this page? Because it WORKS, it is easy to UNDERSTAND and although the page was written in 2005 it is relevant in 2011 and beyond. Thank you for taking the time to write the page and maintain it. I have bookmarked it for future use.
Thank you,
JCrowe
I have a question. Is it possible to vertically align the text fields in I each of the div's so they align in the center?
ipad 3 keyboard
thanks for this layout, as Chi said it is perfect for repeating data. I'm currently using it to set up a form.
code is incomplete.....
it will not produce 3X3 table.., will only produce 1X9 matrix.
Very Interesting approach, I used it effectively to make a left-fixed-panel, and the right scrollable. I am having difficulty putting buttons on the fixed panel, to position the scrollable to my anchor points.
Cheers
Good for when it was written but now well out of date.
The suggestions given on the page are really productive. I got the reqd output by using these suggestions.
Thanks A Lot To the Author.
The page is the BEST.