Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - Tables in CSS, hm? | New poll | | |
Add to favorites | Next newer thread | Next older thread |
User | Post | ||
HyperHacker Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6284 days Last view: 6284 days |
| ||
Everybody now seems to be obsessed with the idea "OMG don't use <table>, use CSS" when it comes to web design. So, a simple question. Here is an effect achieved using tables:
As you can see it has two boxes next to eachother. Now, how am I to recreate that in CSS without resorting to absolute positioning? It seems I have two options, using <span> : or using <div> : <span> fails because something just completely breaks, and because it appears to be impossible to actually define their width and height, IE they always just take the size of their contents. <div> fails because it's a block element, which means each one is followed by a line break. A quick Google search finds this page, which explains how to make an element in CSS act like a table cell or row or whatever. OK, but why make up my own table elements? I'm still using tables if I do it that way, may as well use <table>. Also, I note that the table borders look nice while CSS "ridge" borders are fat and ugly. (edited by HyperHacker on 11-26-06 12:12 AM) |
|||
emcee Red Super Koopa Since: 11-20-05 Last post: 6284 days Last view: 6283 days |
| ||
It doesn't really have to be either CSS or tables, the too aren't really mutually exclusive. Tables are compliant with XHTML 1.0 Strict DTD. Certain attributes aren't though, but those can be specified through CSS.
A lot of people try to avoid tables because they create a lot of extra code, and bury the content in HTML, but its really just preference. To me, tables are the most intuitive and logical way of structuring a page. Anyway, if you float the div on the left to the left, and set the left margin on the box to the right to width of the left box, plus the gap you want between them, you should get the effect you're looking for. |
|||
Metal Man88 Gold axe It appears we have been transported to a time in which everything is on fire! Since: 11-17-05 Last post: 6283 days Last view: 6283 days |
| ||
Bah, humbug. <table> will remain superior in my mind, and if browsers, try to drop support for it, I'll make an entire league just to stop them.
CSS just can't touch it, not without a disproportionate amount of effort, for people like me who've been doing it for years. |
|||
HyperHacker Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6284 days Last view: 6284 days |
| ||
Originally posted by emcee Well the code isn't nice by any means... but throw a little PHP in and just about any code is going to be messy.
So float would make it ignore the first box, placing the second where it would be? And then I use margins to position the second? I already did the job with tables but I might go back and re-do it with CSS if possible. Also, is it possible for PHP to get the IP of the server it's running on, regardless of the client's address? IE I want to see the server's real IP (73.something.something) even when viewing the page from localhost. $_SERVER isn't much help: [HTTP_HOST] => 127.0.0.1
(edited by HyperHacker on 11-27-06 11:07 AM) |
|||
Mega-Dog Since: 11-19-05 From: Minnesota Last post: 6305 days Last view: 6286 days |
| ||
CSS Can cause problems in most browsers. I know that in lololol it doesn't have complete CCS Support. Alot of times when developing also you cannot depend uppon the CSS since the page is developed in order...future refrerences to php and such cause layout to change... | |||
Tarale 2710 Affected by 'Princess Bitch-Face Syndrome' ++++!! Persona non grata Since: 11-17-05 From: Adelaide, Australia Last post: 6283 days Last view: 6283 days |
| ||
Originally posted by emcee I would say it's more than just preference. But then I guess it depends if you care about accessibility or not. Its not considered a good idea to use tables because of the way Screen Readers and such will try to read them. CSS allows you to structure your stuff based on content, making it a lot easy for visually impaired users to browse your page. If you don't give a flying fuck about accessibility, then do whatever you like. As for CSS support, it's quite well supported in most browsers, its just there are a few quirks that are likely to appear, particularly if you are not using valid code. As with all other code, it's a matter of testing in each browser. |
|||
Xkeeper Took the board down in a blaze of glory, only to reveal how truly moronical ||bass is. Since: 11-17-05 From: Henderson, Nevada Last post: 6283 days Last view: 6283 days |
| ||
To whoever said "div" tags create cleaner code, in most cases, you're pretty wrong. I've seen many instances where there were literally so many divs within divs I got a massive headache from trying to figure it out... especially since it was something that would easily be handled by a single table.
I could probably recreate the effect with some work, but at the moment I'm too lazy and the "spaced" border you have there would be fairly difficult to keep correctly.... but I'll see what I can do. :/ |
|||
emcee Red Super Koopa Since: 11-20-05 Last post: 6284 days Last view: 6283 days |
| ||
Originally posted by Tarale Yes, if they're using very out of date screen reader software, they may have problems. But if they're using an out of date browser, they may have problems with divs. You can't really cover every situation, so I think its best to assume people have reasonably update software. It's possible to optimize a web page for screen readers. But you can't just switch to all divs and assume that it will work. Using divs can actually make matters worse, especially when using floats. Both approaches can be made to work just fine with screen readers. It's just a matter of testing. |
Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - Tables in CSS, hm? | | |