English 中文(简体)
What are some alternatives to CSS to style your websites?
原标题:

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?

最佳回答

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.

问题回答

Generally speaking, CSS is not the problem. Rather it s those authoring the CSS that need help. Write standards-compliant code, use a standards doctype, don t depend on experimental features, and carefully implement progressive-enhancement.

Following these simple rules will ensure that your projects will play well with various browsers, and behave in a manageable way. Most issues that frustrate developers are the direct result of those developers not doing one or more of the previous suggestions and not the result of language-designers or browser-vendors failing at their jobs.

Programming and Web Development are not trivial careers; they require constant studying and self-improvement. Unfortunately we developers are often times rushed and aren t able to give our profession the care and nurture that it needs, and this creates more problems than we can comfortably handle.

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

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.

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.

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.

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

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.

Here are some alternatives:

  • image maps
  • pre formatted layouts
  • table formatted layouts
  • XSL-FO=>HTML formatted layouts
  • object formatted layouts

References





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签