<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8272415\x26blogName\x3dAble+Net+Design+Diaries\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dSILVER\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://ablenetdesign.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://ablenetdesign.blogspot.com/\x26vt\x3d270132006207329935', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Official Sony Online Store

Monday, August 28, 2006

CSS Div Tables

Since I now strive and insist that we develop in the latest css and xhtml standards, I came across an issue I wasn't sure how to handle.

It started when I was developing the now uploaded new Added Tech website. Being a drainage company specialising in strom water drains and things like that, there were a considerable amount of test data that needed to be displayed. Now back in the day I would have just insterted in into a table and of we go.

So anyway I put the information in a standard html table but the code just didn't look right. The table tags almost made the code look square so the nice clean feeling was suddenly destroyed. That is when I went in search of a solution.

This is what I came up with, this example has only two columns, but on the same site I have successfully ported it to a ten column table.

div

#table {width:
100%; margin: 0; padding:0;}
div#leftcell {display: td; margin: 0; padding: 2px; width: 18%; float: left; font-weight: bold;}
div#rightcell {display: td; margin: 0; padding: 2px; width: 81%; float: left; clear: right;}

The first line emulates the <table> tag. So there is nothing to special about that. To make each div display as a table cell we needed to set display:td; for those that have become familiar with <td> you would have noticed the similarity. The only difference is of course there is no <tr> or table row tag. Instead the last cell (in this case rightcell) we set clear:right; which then makes anything after that appear underneath hence emulating <tr>.

Lets have a look at the xhtml code:

<div id="table">

<div id="leftcell"><p>First Row Left Cell Text</p></div>
<div id="rightcell"><p>Right Cell Text</p></div>

<div id="leftcell"><p>Second Row Left Cell Text</p></div>
<div id="rightcell"><p>Right Cell Text</p></div>

</div>

This is just a simple two row two column design but you can see that changing certain attributes in the css you can create a more advance form.

That is basically the new form of xhtml and css tables. Nice, clean, so what more could you want.

Tags: , , , , , , , , , , , , , , , , , , , , , , , ,

WebFast CMS version 2.0
Gain control of your website NOW!.

9 Comments:

At 8:07 PM, Blogger arslan220 said...

London based website design company offers website design, shopping cart development, web development, SEO services, server administration services, web hosting.

http://www.1websitedesign.net

 
At 2:16 AM, Anonymous Anonymous said...

You can do multiple rows but with no way (that I know of) to do column spanning, your subsequent rows will have the same widths as the first row. Responsive Web Design Firms in india

 
At 3:25 PM, Blogger lilanlan said...

good web
Perth escorts

 
At 7:39 PM, Blogger Freya said...

Nice one. The blog layout seems to be very fine!
Ecommerce App Development Company | Mobile App Development Company In India | Best Web Design Company India

 
At 11:47 PM, Anonymous Byorn said...

Best escort in Brussels com on!

 
At 7:42 PM, Anonymous Simon said...


Vancouver escort girls
are wayting for you)

 
At 3:18 PM, Anonymous APX Hotels Apartments said...

This post is very educational keep it up APX Hotels Apartment

 
At 1:24 AM, Anonymous Anonymous said...

This new classified site may be a free website for our users as backpage alternatives. Our aim is to modify each business owner to attach with consumers and sellers on-line. you'll post your advert for any price, from cars to physics, from article of furniture to article of clothing, and far a lot of. Submit ads freed from value by simply making an associate degree account begin advertising within the only method at Backpage alternatives
www.thehidelist.com

 
At 7:30 PM, Anonymous Anonymous said...

Hi, don't miss this email:
After the closure of cityxguide and Backpage, most escort or massage advertising providers are looking for a classified advertising site that looks great and is very convenient to use.
Here, ebackdate is successfully launched. The classification of the website is only for escort and massage. In addition, you can post your ads for free, and refresh your ads to the top of the area list every 6 hours on the control panel for free, Keep your ad at the top of the area .
Now, want to find a best alternative to Backpage and Cityxguide website?
Join ebackdate and start posting your ads without any restrictions!

Click here to enter ebackdate: ebackdate escorts

 

Post a Comment

<< Home