views:

1701

answers:

14

Is there a style sheet formatting language alternative to CSS? Or is CSS the current single language for doing Style Sheet formatting type things?

I looked at the write up of CSS on Wikipedia (http://en.wikipedia.org/wiki/Cascading_Style_Sheets) and a few other comments about CSS and became discouraged about the lack of full support for CSS in the different Layout engines, so I am just curious if there is an alternative or I must learn to also use CSS filters.

Thanks for any insights.

+1  A: 

Only one, as far as I know. At least for HTML and such.

See also http://www.w3.org/Style/CSS/

Svish
+2  A: 

The only alternative is the deprecated formatting support that HTML itself has, like the <font> tag. But you don't want to do that. 8-)

RichieHindle
If you use <font> you might also experience mildly intense hatred from other web developers like me :p (At least if they have to read/fix your code...)
Svish
+3  A: 

became discouraged about the lack of full support for CSS in the different Layout engines

I think jQuery has some ways to make css more compatible across-browsers, i.e. if you specify some attributes using jQuery then it will try to make sure to use a work-around for browsers that don't support certain features.

There's also a project called CleverCSS, you might want to check it out. It's not an alternative to it though, just a slightly different way to define it.

hasen j
pretty cool idea the CleverCSS. +1 for mentioning it
Gaby
+5  A: 

Wide-spread CSS does not get full support in all browsers...how should an (unknown) alternative reach this goal?

Scoregraphic
+3  A: 

Nope, CSS is the way to go now. There's nothing wrong with the format itself (I personally quite like it actually), but rather only the browser support for it - especially regarding IE. Once we have all major browsers supporting CSS3, things should be fine - though I'm not too optimistic over when that will happen.

Noldorin
+6  A: 

Well, CSS 2.1 is pretty well supported by nearly every browser. (except IE6) It's easy to write gracefully-degraded CSS once you know the safe subset. (So that even unsupporting browsers won't totally mess the page up)

See http://www.quirksmode.org for CSS browser compatibility hints.

EFraim
+1 for quirksmode - every user starting with CSS needs to know about that. I'd add that IE7 is pretty bad with CSS2 too, and unfortunately most of the web (and almost all corporate networks) are IEs 6 and 7 only, so you have to be careful with CSS2.
Keith
+2  A: 

There is no alternative to CSS right now and this is a Good Thing. The browser vendors, W3C, WHATWG etc have a hard enough time agreeing on a single spec as it is, can you imagine what would happen if there was more than one spec?

Anyway I found that once you learn CSS, you gain knowledge of what particular things break what and either learn to work with it or avoid it.

Hope this helps.

Darko Z
+1  A: 

As everyone else said, CSS is your only real option, but there is another language for "style sheet formatting type things" on the web, called eXtensible Stylesheet Language (XSL), particularly the subset of the spec that became known as XSL-FO (formatting objects).

At one point, depending on who you asked, it was intended to compete or collaborate with CSS.

Patrick McElhaney
The W3C has a good summary of the relationship between XSL and CSS: http://www.w3.org/Style/CSS-vs-XSL
Patrick McElhaney
+25  A: 

CSS is the only real option.

Browser support for CSS should not be a major concern (in most cases) once you learn the ins & outs of CSS. The key to understand about CSS is that its purpose is to define the style of an HTML document and it should be separate from the content.

You'll need practice in learning how to make things degrade gracefully in browsers that don't support features. The basic idea here is that you should make the lowest common denominator (Internet Explorer usually) work "good enough" that it doesn't take away from the user experience, and provide the niceties for users with better browsers. Also, don't develop for Internet Explorer first. Leave it until last, then fix its bugs. Doing things the other way around (IE first) is much harder.

You also have the option of using JavaScript to set styles, but that is not recommended because you should avoid applying styles within JavaScript since JavaScript is meant for logic, not styles.

There are 3 (depending how you look at it) components to a web page:

  • HTML - for content
  • CSS - for styling your content
  • JavaScript - for applying additional or dynamic logic to your content
Dan Herbert
Rob Allen
@Rob Allen: hear, hear
annakata
+1: ...for an excellent answer. The suggestion to code to standards first and _then_ patch the bugs in IE's cruddy rendering engine is definitely the way to do it.
Jon Cage
When you know CSS well, IE7 actually behaves quite well.@Rob: hear, hear +1.
rpflo
Thanks again to all who answered and I really appreciate the clarification.
JustADude
+1  A: 

No (mostly)

If you want to create layouts that work in the maximum number of client machines then you'll have to learn CSS.

If you can limit your users to IE8, Chrome, Safari and Firefox then you can probably get away with CSS2, otherwise you're going to have to learn all the differences with CSS1, along with the myriad broken things - especially in IE5 and 6.

HTML 3.2 includes some formatting tags (such as <font> or <center>) but you can't do much with them.

Why only mostly? - If you can assume that users have either Flash or Silverlight and build web applications for them. Then your layout will be perfect, but it'll need a client side plugin (which not everyone has) in order to work. I'd only go down that route if you need really rich client UI.

Keith
Actually, you can do quite a lot with HTML 3.2 formatting tags and table-based layout. For example, this is my old website (about 10 years old): http://www.itek.at/alt/ganzneu-eng.html
ammoQ
you actual site is done with layout table too. you loose *accessibility, *ability for maintaining , *a lot of those 30% internet-users with handycaps, *machine-based interpretation (like google) *...
vikingosegundo
Nothing you can do with 3.2 is acceptable in modern development on bandwidth, accessibility or maintenance grounds. There's just no purpose to downscaling if you aren't required to.
annakata
@ammoQ - yeah you can, but it takes a while and is a mare to change. Scroll back to the early 00s and site design was about slicing up a big image and putting the resulting jigsaw into a table. I did plenty of it and it's not that good compared to the modern stuff. You can do a site that way, but it will look like it was last updated in 2002.
Keith
+4  A: 

I looked at the write up of CSS on Wikipedia (http://en.wikipedia.org/wiki/Cascading_Style_Sheets) and a few other comments about CSS and became discouraged about the lack of full support for CSS in the different Layout engines, so I am just curious if there is an alternative or I must learn to also use CSS filters.

CSS is the standard. There is no alternative.

All browsers support the basic CSS features. Each new version of each of the (four?) main browser lines comes with increased support for the standard, but websites that use these features will be broken to any users in an earlier version. There are two answers to this:

  1. "Graceful degredation" (or its twin, "Progressive enhancement" - google it), in which the page takes advantage of advanced features if they're available, while still continuing to work if they're not.

  2. Who are your audience? If you're lucky enough to know that 99.8% of visitors to your website will be using at least IE7, then you don't need to worry about the CSS features that are broken in IE6. This will depend on your own business though, so check the facts first.

The worst thing you can do is code to the quirks of a single specific browser, because that leads to a page that's broken not only on other browsers, but even on later versions of the same browser.

Marcus Downing
+1  A: 

I agree that the current state of CSS support is pretty horrible.

I think the best approach is to write CSS according to the standard and then add fixes for all the bits where the various browsers don't properly comply. It's often worth avoiding some bits of CSS if you though (z-levels for example have really mixed levels of support in a lot of browsers).

Jon Cage
A: 

xslt is an alternative

It is more powerful than css.

It is more difficult to learn and to use it.

Zoli
how is XSLT an alternative to CSS? They do completely different things.
Mr. Shiny and New
I think they may meen XSL-FO, which is fine but AFAIK dosn't work in a browser.
Jeremy French
No, I do not mean XSL-FO, just XSLT.In XSLT you can express transformations, therefore with XSLT you can express any kind of formatting that can be expressed with HTML. OK, that is less then what CSS can do, but I have not said, that XSLT is a perfect alternative.XSLT stuff is also in a separate file, like CSS, and from HTML one can refer to the XSLT file. Because of these 2 properties, one can do formatting for his/her HTML-based document without much redundancy. XSLT works in Firefox, IE, I have not tested others.
Zoli
No, Zoli. You can not do formatting with XSLT. You can interfere with the original code, transform it, add to id, remove from it etc.. but you cannot style it ...
Gaby
A: 

Zoli is right. "xslt is an alternative"

XSLT turns XML into a rendered web page, just like CSS turns HTML into a rendered web page. Just note that you can't mix XSLT with HTML or CSS with XML.

I've used both CSS + XSLT to create rendered web pages.

Brian Kueck