views:

214

answers:

8

After asking this question, it appears that a lot of CSS hacks and tricks are needed to achieve something that simple. People have said that CSS is broken.

So I wonder now, if not CSS, what are some alternatives to creating advanced html structure and markup/layout?

Are we left with tables and framesets? Or is there something else?

+1  A: 

If by "advanced" you mean very complex like desktop application UIs, then yes, sooner or later you will have to use tables.

It is considered that using tables for design is wrong, but since we figured out CSS is "broken", then why would it matter anyway? You're apparently out of options.

It is a pity that boys responsible for development of HTML and CSS have made mess of the things. Web development could have been in advance by leaps now. We can only hope it will get streamlined in the next few years with HTML5, CSS3 and browser improvements.

Developer Art
Because good CSS is MUCH more efficient at styling site-wide than anything else. Use CSS where possible, but don't be afraid to fall back to tables where necessary.
MindStalker
Just to add detail: Tables allow you to specify a layout where column width depends the relative amounts of space needed in each column. Since column contents can themselves be deeply nested or simply large, etc, this is potentially a devastatingly expensive operation - any re-layout may end up being recursively complex. To address performance-related whines, the CSS folks didn't want us playing with that particular toy, so they effectively simply took it away from us. Performance problem solved :)
Carl Smotricz
+3  A: 

I would say the recommended way is to stick it out with HTML (possibly HTML 5 markup) and wait for CSS to get fixed with CSS3. I wouldn't suggest going back to tables and/frames.

If you need more layout control, consider doing your website in another technology, such as Silverlight or Flash

Bryan Ross
+1 for the first para, -1 for suggesting considerably heavier technologies when DHTML might do just fine.
Carl Smotricz
Do you have any resources explaining how to develop basic structures with pure html while not using tables or frames? For example, a header on top, a menu and content window in the vertical middle and a footer which will always be at the bottom. Of course the height of the content window would be dynamic to the content.
Tom
I didn't get a useful answer, but I was sent a link to a site ridiculing table users. Please read *both* my answers (and the following comments) here: <http://stackoverflow.com/questions/1852112/set-divs-height-to-occupy-the-contents-layout/1852126#1852126>
Carl Smotricz
@Carl Smotricz: Ouch. It just seems to me like he needs finite, exacting control over the layout. Even when using DHTML/Javascript, there's still all sorts of idiosyncrasies and peculiarities to deal with. Yes, even when using something like jQuery/Prototype/Moo/etc...In that case, another technology like I suggested would be a perfectly valid solution, given the requirements, and would probably make it much easier on the development side.
Bryan Ross
I hate Flash and Silverlight, both as a dev and a user. That explains my animosity (sorry). But enough of that, I'd like to clear up a misconception here: Many of the things you can't do in CSS are layouts easily addressed by different, more versatile rule sets. Case in point: GWT. They implement the equivalent of various Swing layouts in HTML with CSS, stooping to tables when they have to, and thus make many "interesting" layouts possible. Much improved since recent ver. 2.0 . Recommended!
Carl Smotricz
Well, I'd definitely check that out if I didn't have a pathological aversion to Java haha. Thanks :)
Bryan Ross
+8  A: 

CSS is broken, but the best way is still CSS.

While CSS itself may have flaws and missing features and be generally crappy, and while it may not work the same in every browser, it's still the best tool for the job. Its still an extremely flexible tool, albeit a slightly broken one.

ShZ
+10  A: 

CSS is not the problem. Many who write CSS are.

Write your HTML/CSS/Javascript carefully, and you won't have any major problems. You may at times be required to re-think the "easiest route," but don't blame the technology. I have yet to use any hacks in my work, and I find no problems getting my markup and styles to operate as expected. As I said, sometimes you'll need to stop, rethink, read a bit, and return to the project. But don't blame the technology.

Jonathan Sampson
Those who develop CSS or who use CSS? If the latter, you might want to check out the question posted in the original post. Apparently, noone there managed to solve the problem without using hacks, tricks or different methods for each browser.
Tom
+1 I do concur.
Tor Valamo
@Tom: check my solution posted for that question... it works in all browsers with no hacks.
Tor Valamo
Thanks, but when the text box's content exceeds the original height, the box does not dynamically grow with the content while it should (the same applied for other suggestions done earlier).
Tom
There are entire classes of layouts that CSS does not enable, and which no amount of "rethinking" and pondering CSS will resolve. A subset of these problems can be addressed using tables, so it's not like they're horribly arcane. I downvoted you because you deny this fact.
Carl Smotricz
If you enjoy a CSS challenge, I look forward to your solution to this question: <http://stackoverflow.com/questions/1870205/html-layout-title-and-button>
Carl Smotricz
@Carl, I don't deny that some things aren't possible. I deny that this therefore means "CSS is broken."
Jonathan Sampson
+1  A: 

Many interesting layouts are possible with CSS. As the share of IE6 in the world is declining, the compatibility situation is slowly improving, too. You can also make a lot of browsers behave better by putting proper headers on your HTML.

For some intended layout cases, the answer I get to questions like yours is often "change your design".

Some layouts can be achieved using tables to partition vertical and horizontal space. I always get flamed by the CSS purist zealots when I suggest this, but they usually don't have any better alternatives to offer.

That said, it's a good idea to use tables as little as possible, as this use doesn't correlate well with their intended meaning and purpose. Consider tables an emergency hack for those cases where CSS solutions would be a lot more hackish.

Carl Smotricz
+2  A: 

CSS is not "broken" simply because it doesn't work the way you think it should. Looking at your previous question, your premise is that what you did was correct, and that margin-bottom wasn't doing what it should. This is a faulty premise. Respectfully, your understanding of the CSS box model is flawed.

I answered your previous question there.

stephenhay
A: 

If not studied correctly CSS can appear broken. It is simple to learn but a little tricky to master. Maybe run through some more tutorials and get a better grasp on the box model and such before writing it off.

That being said CSS still angers me on an almost daily basis but it is still the best.

Davey
+1  A: 

Hate to burst anyone's bubble but all of HTML is styled with CSS whether you use CSS directly yourself or not. You can view the internal CSS styling of many of the browsers including how it style tables and frames. In Firefox, look in the res folder for html.css

Rob
Interesting, thanks a lot.
Tom