views:

135

answers:

4

Is separation of Content, presentation and behavior possible every time ?

alt text

Many time through javascript we add classes to html and we use in CSS visibility:hidden inline.

Should we always invest time ti keep all separate?

+1  A: 

Your question is quite too general for us to give you a definite answer.

But, as nothing is impossible, I would say that, yes, it is possible.

In the same time, I would say that :

  • Sometimes, it'll cost so much that you won't do it
  • Sometimes, it'll make things much harder than not separating, so you won't do it
Pascal MARTIN
A: 

I think that as conceptual separation, yes.

Aito
+1  A: 

While it is usually possible, it is often not practical. As you say yourself, it costs time. Whether you are willing to invest that time is subject to many factors, of which purism is only one.

In fact, it can be argued (and I've witnessed it being argued first-hand) that since tags such as div or span don't carry any semantical meaning in and on themselves, but have been invented specifically for styling, the moment you use a single one of them on your page, you are already mixing content and presentation. This is a nice philosophical discussion to have, but in business context it leads nowhere.

So, while you should always try to separate content, presentation and behavior as much as possible, you will always have to stop somewhere, if only to get other things done.

RegDwight
I don't think that using "<div class='background-information'>" is necessarily more about style than content. HTML isn't perfect, and I don't think anybody would claim that the set of "meaningful" HTML elements covers all possible semantic constructs anybody should ever need. And really, what does "<p>" say about content? Nothing, really; it says "this is a paragraph," which is as much about layout (typographical convention) as semantics.
Pointy
But note that I'm not trying to be argumentative. It's an interesting topic.
Pointy
@Pointy: absolutely. I guess what I'm trying to say is that when Larry (or was it Sergey, I forget) wrote the first Google (or BackRub) home page, he famously did it willy-nilly. He didn't know HTML, he just figured out how to make a search field and a submit button, and then he moved on. Now look where Google is today. And they are *still* famous for using invalid markup as long as it works. Now, of course, that is not *the* best approach in and on itself, and not every Web site is the next Google. But it does illustrate a point, namely that there are *many* factors to success beside purism.
RegDwight
Css content property also break this rule
metal-gear-solid
+1  A: 
Pointy
i've already mentioned abut this see my question "Many time through javascript we add classes to html "
metal-gear-solid