Slashdot Mirror


CSS Selectors as Superpowers

An anonymous reader writes "Simon St. Laurent writes in praise of CSS selectors: 'After years of complaints about Cascading Style Sheets, many stemming from their deliberately declarative nature, it's time to recognize their power. For developers coming from imperative programming styles, it might seem hard to lose the ability to specify more complex logical flow. That loss, though, is discipline leading toward the ability to create vastly more flexible systems, a first step toward the pattern matching model common to functional programming.'"

135 of 190 comments (clear)

  1. Completely agree by Chrisq · · Score: 5, Informative

    Anyone who has used JQuery will know how their power exceeds the original intention

    1. Re:Completely agree by itsdapead · · Score: 4, Insightful

      Anyone who has used JQuery will know how their power exceeds the original intention

      ...anybody who has used jQuery will know how powerful they could have been if only browsers had implemented them completely and consistently.

      Meanwhile, anybody who has used CSS will wonder what the hell the original intention was, given the arcane kludges needed to produce popular web-page layout effects easily achieved using evil tables and frames, the lack of 'constants' to set standard colours and measurements.You know there's something wrong with a standard when Microsoft's broken box-model implementation makes more sense. However, that's not the fault of the selectors.

      Its as if the designers* of CSS had never looked at a web site, used a DTP package, used styles in a WP package, let alone played with a Java layout manager to get ideas about what might work and/or be useful.

      (* probably unfair - I'm sure it was a mixture of committee syndrome and the notion that you can define a standard without producing a reference implementation rather than individual failings).

      --
      In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
    2. Re:Completely agree by Anonymous Coward · · Score: 1, Interesting

      Many of the problems of CSS are fixed if you use something like SASS or LESS that let you use mixins. They make it easy to define variables and even functions for things like common colours, borders and margins, effects and stuff like that. They also serve as a nice insulation layer between grid frameworks (which are very useful, but encourage presentation in your HTML, e.g. class='four columns') and the nice semantic CSS/HTML you know you should be writing. Hopefully at some point in the future they'll be part of the standard.

    3. Re:Completely agree by dingen · · Score: 2

      ...anybody who has used jQuery will know how powerful they could have been if only browsers had implemented them completely and consistently.

      This used to be true a few years ago, but all modern browsers nowadays parse selectors quite similar. Even IE8 is not so bad (it understands CSS 2.1 selectors like :first-child and [attribute] etc.).

      Of course things keep evolving all the time, so if you want to use cutting edge stuff, you might run into some things. But in general I think especially the selectors are amongst CSS' least problematic areas.

      --
      Pretty good is actually pretty bad.
    4. Re:Completely agree by dingen · · Score: 4, Insightful

      Things like SASS and LESS point out where the big flaws of CSS are. It's crazy we still don't have variables in 2013 by default, this has been at the top of the requested features list for what, 15 years now?

      --
      Pretty good is actually pretty bad.
    5. Re:Completely agree by Yvanhoe · · Score: 2

      Meanwhile, anybody who has used CSS will wonder what the hell the original intention was

      It was to provide an easier alternative to xhtml/xsl. Instead of the total separation between data and formatting that many programmers rooted for, it is a bastard compromise that was reached : HTML would still specify both data and formatting but formatting would "skinable".

      Some days I think that we live anyway in a world of compromise and that it is true that HTML/CSS is easier to use in 95% of case, yet other days I wonder if in the end we are not doomed to come back to the original intent, after a long path : have a Turing-complete language generate the formatted page from an XML content.

      --
      The Wise adapts himself to the world. The Fool adapts the world to himself. Therefore, all progress depends on the Fool.
    6. Re:Completely agree by WizardFusion · · Score: 3, Interesting
    7. Re:Completely agree by dingen · · Score: 1

      That makes no sense. CSS could easily be fixed by a lot of the things that are already in SASS and LESS. They are not different tools for a different job.

      --
      Pretty good is actually pretty bad.
    8. Re:Completely agree by BasilBrush · · Score: 4, Interesting

      What box model would be best?

      Serious question. I'm doing a specialist graphics app at the moment, and I was just considering this the other day. What's the important rect for a box?

      Most graphics app use a rect that is halfway through the border by default, as a result of the concept of "stroking" the rect. CSS is very different, and as you say a bit broken, by default using outside the margin for position, and content rect for size. So there's no concrete rect for layout of a box at all in CSS. And then there's box-sizing, which could allow the concept using the same rect for positioning and size, but doesn't.

      How would a designer prefer to think of the primary metrics of a box, for the sake of alignment, snap to grid, proportional resizing etc?
      1) Margin rect
      2) Outside border
      3) Centre of border
      4) Inside border (outside padding)
      5) Around the content (inside padding).

      Of course, "all of them" and "it depends" are rational answers. But not much use when deciding on default or standard behaviour.

    9. Re:Completely agree by chris.alex.thomas · · Score: 3, Insightful

      not true, there are clear defects in the tools that almost everybody agrees on (variables), plus the browsers don't support everything even though the specs are years old.

      sometimes the tools really are bad....

    10. Re:Completely agree by Anonymous Coward · · Score: 1

      I had this conversation yesterday with someone who is convinced that IE6's take on width and padding is correct. I can't say it isn't.

      Agreement is the crucial point. Good luck with your app!

    11. Re:Completely agree by Lumpy · · Score: 1

      " given the arcane kludges needed to produce popular web-page layout effects easily achieved using evil tables and frames, the lack of 'constants' to set standard colours and measurements."

      This, a thousand times this. Honestly, why the hell has CSS not been fixed? They could have easily added what was needed to make things a lot easier. but instead they force everyone to fight with it.

      --
      Do not look at laser with remaining good eye.
    12. Re:Completely agree by Lumpy · · Score: 5, Funny

      Tell that to the guy that has to build a house with a saw that has no teeth.

      He will probably beat you to death with that saw. People that have no clue at all as to the problems with the tools or even how to do the task are the first to blame the craftsman.

      --
      Do not look at laser with remaining good eye.
    13. Re:Completely agree by M.+Baranczak · · Score: 1

      generate the formatted page from an XML content

      Some web programming frameworks already work like that.

    14. Re:Completely agree by Bazman · · Score: 4, Interesting

      And now your web server has to do PHP processing on every page and every style sheet, so your load goes up. So you implement some caching. Now you have two problems.

    15. Re:Completely agree by AvitarX · · Score: 2

      I always thought it should be the border, with padding pushing the content in, and margin pushing other content away.

      it would make % sizes work more intuitively I think.

      --
      Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
    16. Re:Completely agree by mwvdlee · · Score: 1

      I swear by LESS, but it isn't a standard and requires too much CPU (whether processed server side or client side), and it doesn't fix a model which makes it very difficult to do very common layouts.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    17. Re:Completely agree by CastrTroy · · Score: 1

      Yeah, better to just have a PHP script which generates a CSS file and run the script whenever changes are made and you need to refresh the style sheet.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    18. Re:Completely agree by CastrTroy · · Score: 1

      Even IE8 (If you use the proper DOCTYPE to bring it out of legacy mode) is not so bad (it understands CSS 2.1 selectors like :first-child and [attribute] etc.).

      Fixed that for you. This has to be the most annoying part of it all. They really should have implemented the opposite where you required a special doctype to put the browser into legacy mode. Would have made everybody start to make their pages standards compliant much sooner.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    19. Re:Completely agree by mortonda · · Score: 3, Funny

      And now your web server has to do PHP processing on every page and every style sheet, so your load goes up. So you implement some caching. Now you have two problems.

      3 problems.... php itself being one.

    20. Re:Completely agree by dingen · · Score: 2

      On the other hand, this really forced devs to include the proper doctypes in their work, which is a good thing!

      --
      Pretty good is actually pretty bad.
    21. Re:Completely agree by jonr · · Score: 2

      He's using PHP? I get the pitchforks!

    22. Re:Completely agree by dingen · · Score: 1

      Yeah, I suppose you could do that. Or you could just use LESS or SASS, which basically do the same thing and give you a whole lot more.

      --
      Pretty good is actually pretty bad.
    23. Re:Completely agree by hcs_$reboot · · Score: 1

      You don't need another "I do agree 100% with what you said" since you already got the +5 In. But you just said a very nice way.

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    24. Re:Completely agree by StripedCow · · Score: 2

      Don't make it standard behavior.

      E.g., instead of letting the designer specify "width", let him specify "content-width", or "outside-border-width", or "margin-width", etc.

      And in case of conflicting specs (e.g. two or more conflicting attributes given) produce an error (don't choose a precedence order!).

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
    25. Re:Completely agree by itsdapead · · Score: 1

      Bad craftspeople have a definite tendency to blame their tools

      ...and bad software designers have an even more definite tendency to blame their users. Usability/clarity and appropriateness for the intended user base (in this case, graphic designers) is part of good tool design.

      CSS smacks of being a hammer designed by someone who has never seen a nail.

      --
      In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
    26. Re:Completely agree by RevDisk · · Score: 5, Insightful

      I always liked PHP, but I'm an infrastructure guy who only uses PHP for relatively minor stuff. Something doesn't need to be perfect to be useful.

      Please don't burn me, I don't weigh the same as a duck...

    27. Re:Completely agree by Qzukk · · Score: 1

      What box model would be best?

      One that allows me to discover BOTH inside and the outside sizes so I can measure BOTH what will fit in my box, and what my box will fit in!

      Thanks jquery!

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    28. Re:Completely agree by der_joachim · · Score: 1

      So use a LESS compiler then: edit LESS-file, compile to CSS, test CSS locally, upload to server. Rinse and repeat.

      --
      Geek runner, motorcyclist and professional know-it-all
    29. Re:Completely agree by drakaan · · Score: 1

      ...or you could just use the existing features in CSS and HTML (and javascript, if you feel like it), let people know when they're using a broken browser and why things look stupid, and let the complaining get it fixed.

      Microsoft actually fixed some extremely broken things in IE after they realized that developers cared and that supporting standards enabled other browsers to do things that didn't work right in IE (I actually just got done reading some developer blurbs on their new Ajax Control Toolkit that mention functionality Firefox and Chrome but *not* IE).

      Selectors are only this amazing "new" thing because designers have dumbed down their sites to work with IE and IE has had really crappy support for selectors (with the exception of some things related to anchor tags) for a very long time.

      Bitching about the standards without understanding why they haven't been more useful is counter-productive (and whoever said that IE's box model makes the most sense is smoking some really expensive crack).

      --
      "Murphy was an optimist" - O'Toole's commentary on Murphy's Law
    30. Re:Completely agree by BasilBrush · · Score: 1

      As far as I can see that's still not a best box model. It's mostly just different varieties of patching over what's broken. Those are just sizes, they're not rects.

      outerWidth(true) does at least match the same rect as CSS left. But is setting/getting a rect by the outside of an invisible margin (that may or may not be collapsed) anyone's ideal metric?

    31. Re:Completely agree by mwvdlee · · Score: 1

      That is exactly what I'm doing, using lessphp (http://leafo.net/lessphp/).
      I'm using it both to generate some jQuery themes (https://github.com/vanderlee/Afterdark, somewhat old) and dynamically (with caching and "compression") in my own framework.
      But it's not as convenient as just using static files would have been and most importantly; it still doesn't fix the box model.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    32. Re:Completely agree by itsdapead · · Score: 2

      What box model would be best?

      I'd look on it from the perspective of "encapsulation": One person should be able to design what was in the box without knowing how it was going to be placed on the page, a second person should be able to place it on the page and align it with other elements without affecting anything inside.

      That would work best if the primary size of the box included the inner margin/padding and border (which the box designer 'needs to know'), but excluded the outer margin (which the 'page designer' needs to match with other elements).

      As for the border - the most flexible solution would probably be to have a separate 'inner border' and 'outer border' and leave it up to the designer to ensure that the border fit within the margin/padding if desired: the 'box designer' might want the inner border to match the ambient colour of the image and maybe slightly print the photo to 'seal' it; the page designer might want a fancy frame outside the box.

      --
      In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
    33. Re:Completely agree by denmarkw00t · · Score: 1

      It's crazy, but SASS and LESS also deserve to stay in their own separate play-place for now. It's important for these to continue to expand and develop, but in both camps there is constant movement and redesign, no clear stability, and no clear path of where certain features will lead. CSS, on the other had, is generally solid and not often updated. It has to remain rather slow and boring in order to maintain support for all the browsers and designers and companies who are relying on said stability. Variables would be nice, but even adding something simple like that has the potential to raise a ton of questions about implementation, and we all know that the W3C isn't the fastest on the planet when it comes to that stuff...

    34. Re:Completely agree by marcosdumay · · Score: 1

      Yes, so why can we not simply send the SASS to the browser?

    35. Re:Completely agree by denmarkw00t · · Score: 1

      I don't know if LESS has this, but with SASS and Compass, you can tell Compass to "watch" your SASS folder - when any files change, it automatically rebuilds your CSS. Quite nice for actively working in the SASS without having to go back and recompile every dang time you change something.

      On the dev side, all of our SASS is compartmentalized into partials for that particular section "_toolbars.scss, _article.scss, etc" Our local configurations are set to compile the SASS to expanded CSS, complete with annotations and line numbers so we know which rules originated in which source files. When we finally deploy a project, the build script tells compass to generate a compressed CSS file, as well as splitting our our media-query specific styles and styles just for our subsites and IE.

      We looked at LESS, but we wanted more. *ba-dum*

    36. Re:Completely agree by xombo · · Score: 1

      You're able to control how the box model is calculated in CSS3 using the box-model CSS property. You could standardize on the MSIE way, if you so choose.

    37. Re:Completely agree by BasilBrush · · Score: 1

      You mean the box-sizing property. I already mentioned that in the post you're answering.

    38. Re:Completely agree by bad-badtz-maru · · Score: 1

      Best way to kludgy mess, seems like.

    39. Re:Completely agree by BitZtream · · Score: 1

      No, not really.

      jQuery does it, CSS is just the way jQuery is interfacing with the browser. CSS isn't really doing anything but making the situation more complicated and convoluted actually.

      CSS + jQuery, like most things on the web now days was stumbled on, not designed. It was stumbled on because no one bothers to think about what they are putting into HTML and how it affects the future, they only pay attention to what they want in their browser for today. The end result is that most of the system is decidedly BAD, with occasional highlights using weird tricks popping up to sustain it.

      If you think HTML+CSS+jQuery is good ... you don't know what 'good' is. Its a horrible excuse for a development environment.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    40. Re:Completely agree by Wraithlyn · · Score: 1

      the arcane kludges needed to produce popular web-page layout effects easily achieved using evil tables

      Rejoice brother, for the era of display:table-cell has begun (supported in IE8 and up, and IE7 is effectively dead, thank god). Nice clean semantic markup, but now with access to all the juicy table features like vertical & horizontal-block centering, shared column height, and automatic column sizing. (Good article: http://www.digital-web.com/articles/everything_you_know_about_CSS_Is_wrong/)

      You know there's something wrong with a standard when Microsoft's broken box-model implementation makes more sense.

      We now have the option to use this as well :) http://paulirish.com/2012/box-sizing-border-box-ftw/ Again, supported in IE8 and up.

      Especially on responsive/fluid sites (where you often want to do things like, "I want this column to be 33.333% wide, oh but I also want 10px of inner padding"), this is a revelation. Sure we could've used a wrapper div, but sometimes this is not an option, and either way it makes the markup cleaner.

      Other IE8+ stuff we can now use includes:
      - :first-child (but hilariously, NOT :last-child)
      - multiple class selectors (.foo.bar)
      - direct-descendant selectors (.foo > .bar)
      - :before and :after (IE8 still has some minor bugs, but easily avoidable)

      Here's the BAD news:

      IE10 has removed support for conditional comments, and .htc (something like PIE polyfill is now impossible). Go ahead and try getting something like border-image (or even a reasonable fallback) working in IE10, I dare you.

      the lack of 'constants' to set standard colours and measurements

      You're of course correct that native CSS still has no concept of anything like that. This is where LESS or SASS come in. And with the power of mixins (ie, to easily generate all the browser prefixes for more advanced stuff like gradients, shadows, etc), it's getting borderline irresponsible to not use a pre-processor. I instantly switched to SASS when I discovered this: http://jakearchibald.github.io/sass-ie/. This technique, I am convinced, is THE way to write maintainable, sophisticated responsive code (with a good path to easily strip out all media queries for IE8) right now.

      --
      "Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
    41. Re:Completely agree by KingMotley · · Score: 1

      Visual Studio 2012 Update 2 will auto-compile any LESS file as you type in it (I think it does COFFEE as well) into both .css and .min.css versions.

      If it's a .NET site, then you can reference the css files in a bundle which will combine multiple .css or .min.css files into a single file, and will auto build a new one whenever one of the files in the bundles changes. Pretty slick.

    42. Re:Completely agree by KingMotley · · Score: 1

      That's not what box model refers to.

    43. Re:Completely agree by Waccoon · · Score: 1

      It's important to say constants instead of variables. Otherwise, all the functional programming nuts will start going on about flow control and CSS not being a programming language and most logic goes right out the window.

    44. Re:Completely agree by Darinbob · · Score: 1

      I think the original designers were not considering web sites designed by artists who wanted the page to look *exactly* one way. They were for basic generic HTML 1.0 pages, before all this turned into an application-inside-browser style. I haven't done web much but for what I did CSS did it very well.

    45. Re:Completely agree by Darinbob · · Score: 1

      I think someone trying to build a house with a saw is someone using the wrong tool.

    46. Re:Completely agree by Darinbob · · Score: 1

      You mean we go back to Display Postscript?

      Ultimately the problem is that HTML is being used for things that were not envisioned as part of its scope when it was designed. The paradigms used in modern web applications would have been unknown at the start. Sure you could complain that the designers weren't thinking far enough ahead and not making it general purpose enough. But it feels more like someone complaining that shell scripts are too slow for high performance computing.

      Ie, if HTML is the first web language and the gripes are that it has hiccups dealing with modern web applications, why not go for a different language? After all we didn't just keep adding refinements to Fortran and COBOL, we created new languages to deal with the new paradigms that cropped up, as well as the new uses that computers were put to.

    47. Re:Completely agree by WillKemp · · Score: 1

      not true, there are clear defects in the tools that almost everybody agrees on (variables) [......]

      Implementing variables in CSS is trivial - just put your CSS in a .php file like you do HTML and use PHP tags for variables. You can put JavaScript in a PHP file too, and pass variables to JavaScript that way as well.

      [......] plus the browsers don't support everything even though the specs are years old.

      That's not the fault of CSS. Any other system would suffer from the same browser incompatibilities.

    48. Re:Completely agree by WillKemp · · Score: 1

      Tell that to the guy that has to build a house with a saw that has no teeth.

      Mate, i've been a carpenter and i've been a web developer and if you think CSS is equivalent to a toothless saw, you probably don't know much about either trade!

      He will probably beat you to death with that saw. People that have no clue at all as to the problems with the tools or even how to do the task are the first to blame the craftsman.

      And "craftsmen" who are too lazy to learn to do the job properly are the first to blame anyone who tries to point that out.

    49. Re:Completely agree by wertigon · · Score: 1

      I'd say that the web technologies of today *is* broken - but it's more because of what the web has evolved to than anything else.

      The original web was never supposed to be dynamic. It was supposed to be static pages with maybe some theming thrown around for good measure. And for a while, that worked, then came requirements of theming (CSS) and form handling (PHP) and cool effects (JS).

      These days however, it's all about webapps. Few if any sites have static content, it's all in a database somewhere. HTML is merely an afterthought; noone cares whether HTML validates or not, because the pages aren't static and shit just works. The entire "presentation vs content" that was going on doesn't really exist anymore - The content has moved to the database and HTML is today only used as a presentational language. Sad but true.

      Therefore I think we need to rethink and reinvent the entire web as we know it, since the current path will only lead to more and more brokenness. HTML has outlived it's purpose, it's as simple as that...

      --
      systemd is not an init system. It's a GNU replacement.
    50. Re:Completely agree by chris.alex.thomas · · Score: 1

      yes I agree with you, a simple PHP or LESS system will do away with the problems, in fact, I'm planning to start using LESS and server side compilation/caching soon on our website, however it's a problem that the language doesnt support it _BY_DEFAULT_

      sure, I agree it's not the fault of CSS that browsers don't support everything in the spec, but I think we need to start taking responsibility and not delegating so much, you can't say to almost all features that in order to be compliant you only need to support x% of the spec, no, I think we need to start making specifications that work, such as those which say if you don't implement everything in the way that the document explains, you are not compliant.

      when reading through w3c specs, sometimes I'm amazing at how much of the spec is optional.....that needs to stop....I understand the reasons in a way, compromises made by people etc, but I think we need to start saying, YES, you NEED to support THAT option and NO you are not allowed to skip it.

      then we might start to get more specs which actually work in our advantage.

    51. Re:Completely agree by Pseudonym+Authority · · Score: 1

      let people know when they're using a broken browser and why things look stupid, and let the complaining get it fixed.

      Sure, I would, but since I'm not simultaneously Google, Facebook, Twitter, Youtube, Wikipedia, and Amazon, I'll just end up losing pageviews.

    52. Re:Completely agree by mortonda · · Score: 1

      Sure, you can use a bad tool to do useful things, but why?

    53. Re:Completely agree by Yer+Mom · · Score: 1

      Browser support for box-sizing seems pretty good if you don't mind prefixing (and breaking on IE < 8).

      If you set box-sizing: border-box on an element, it'll use the IE quirks mode box model for that element.

      --
      Never mind Spamassassin. When's Spammerassassin coming out?
    54. Re:Completely agree by mwvdlee · · Score: 1

      Great! Now if only I could vertical-align a fluid box without using tables or a whole range of table-* display rules.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
  2. Re:!Like by LizardKing · · Score: 5, Informative

    Bollocks. CSS was designed to separate styling from structure in web pages. It does this admirably, and only needs to be a declarative language to do so. This prevents a lot of "clever" hacks that including conditional or flow statements would have encouraged. It's the same reason why statically typed languages are better than dynamic ones - since the tooling and compile time checks can be much more comprehensive and optimisation is easier - but clueless twats prefer the dynamic ones, since they don't understand the downsides or foolishly think they are so good they wont screw up. Improved programmer productivity claims for including flow statements in CSS (or using dynamic languages) are crap as well, since while a programmer might find it easier to cobble together something that just about works, chances are very high that it will be harder to maintain.

  3. Re:CSS as DSL? by prefec2 · · Score: 1

    CSS is a DSL for styles primarily. It could be used for other stuff as well. There are libraries available in Java. However, I do not know of any C++ library. But google returns just a lot on the topic for "CSS c++ library"

  4. Re:!Like by BasilBrush · · Score: 4, Insightful

    CSS alongside 2 basic layers, regular code and HTML document itself, only creates additional unnecessary third layer of shit that eventually may introduce problems, as soon as someone starts playing with it

    That's like saying MVC is unnecessary, and not just putting all your code in a single class/module/namespace may introduce problems. There are people that say that, but they are novices.

    HTML5/CSS/JS is equivalent to MVC. The "VisualBasic" type people would tend towards trying to put everything in their HTML rather than the other way around.

  5. Re:CSS as DSL? by loosescrews · · Score: 2

    Yes. Qt will let you style the GUI with what is effectively CSS.

  6. Re:!Like by dingen · · Score: 5, Informative

    You have no idea what you're talking about. CSS (and HTML for that matter) have *nothing* to do with programming. CSS is merely a way for designers to code a layout, nothing more, nothing less.

    I do agree CSS could have been a lot better and there are definitely some errors which needs fixing, but the general idea of separating mark up and layout is a sound one and selectors is one of CSS' best features.

    --
    Pretty good is actually pretty bad.
  7. Re:!Like by Anonymous Coward · · Score: 2, Informative

    If that's what you think, then you don't understand why CSS and HTML are separate languages. The implementation is by no means perfect, but its a very good example of Separation of Concerns (separating content from presentation, and in javascript's case, both of those from application logic), something that all too many 'programmers' don't seem to have any idea about. Then again if you're one of those programmers who see SOLID principles as over-engineering then I can understand why you might think that its an 'additional unnecessary third layer'.

  8. No , sorry. by Viol8 · · Score: 1, Interesting

    All non progammatical web code has to do is describe a page. There is no reason on earth for requiring 2 completely different formatting languages - HTML and CSS - to do this. CSS is just a nasty hack on top of HTML which was already a hack anyway and along with embedded javascript its turned web coding into a total dogs dinner.

    1. Re:No , sorry. by dingen · · Score: 3, Insightful

      You're crazy. CSS and HTML are completely unrelated languages and technologies. None is a hack on top of another. HTML describes the structure of a document, CSS defines how things look. It's that simple. They require a different syntax because they are used for different things. And they're both very successful at what they're trying to do. Sure there are problems, sure there are things wrong with it, but show me something perfect. There are two types of languages you know: ones everybody complains about and ones nobody uses.

      I have no idea what you mean by "embedded Javascript", but Javascript is the programming language of the web. Contrary to HTML and CSS, Javascript is a "real" programming language by any definition. Without it web applications would not be possible and the web would merely be a document system. Instead its the world's largest application platform, allowing users on any device to use your applications. If you are a web developer and you think that's not exciting then maybe you should think of switching careers.

      --
      Pretty good is actually pretty bad.
    2. Re:No , sorry. by RabidReindeer · · Score: 1

      All non progammatical web code has to do is describe a page. There is no reason on earth for requiring 2 completely different formatting languages - HTML and CSS - to do this. CSS is just a nasty hack on top of HTML which was already a hack anyway and along with embedded javascript its turned web coding into a total dogs dinner.

      The purpose of HTML is to organize data for display - and possible return via a submitted form. The purpose of CSS is to control the presentation of that data. HTML was invented first, and originally had to shoulder some of the responsibilities of CSS, but CSS is now the preferred presentation control medium, not least of which is that it makes it possible to "skin" HTML to adapt it to multiple display devices and/or view preferences.

      JavaScript exists to allow dynamic manipulation of client-side data, display organization and CSS in a way ensured maximize frustration due to language inconsistencies and client portability issues.

      It is entirely possible to make an unholy mess of these three tools, and people who employ cheap inexperienced programmers generate a lot of it. However, done competently, it is possible to make a much cleaner job of it.

    3. Re:No , sorry. by dingen · · Score: 1

      How so? Care to elaborate or provide an example?

      --
      Pretty good is actually pretty bad.
    4. Re:No , sorry. by RaceProUK · · Score: 1

      How so? Care to elaborate or provide an example?

      http://www.w3schools.com/tags/tag_font.asp

      --
      No colour or religion ever stopped the bullet from a gun
    5. Re:No , sorry. by Anonymous Coward · · Score: 1, Informative

      I haven't seen somebody be so wrong here in years. Just about everything you said is bunk or outright bullshit.

      dingen's bullshit claim: You're crazy.

      WRONG. The GP's assertions are completely true, completely correct, and show a very high degree of sanity.

      dingen's bullshit claim: CSS and HTML are completely unrelated languages and technologies.

      WRONG. CSS and HTML are extremely intertwined and heavily related. Anyone who knows their history knows that they arose and evolved as a result of one another's flaws.

      dingen's bullshit claim: None is a hack on top of another.

      WRONG. CSS is a hack upon HTML, and HTML's evolution has been affected by the hack that is CSS. They're both hacks upon one another, over time.

      dingen's bullshit claim: HTML describes the structure of a document, CSS defines how things look.

      WRONG. HTML does affect the appearance of the document, and CSS does influence the structure. In any moderately complex web page, you'll need to consider both at the same time if you want to achieve anything like the desired outcome.

      dingen's bullshit claim: It's that simple.

      WRONG. If you had any real world web development experience, you'd know how utterly wrong this claim is.

      dingen's bullshit claim: They require a different syntax because they are used for different things.

      WRONG. They can both be represented using s-expressions. It's just that the original designers screwed up by not choosing this natural syntax, and none of the major players have chosen to right this wrong.

      dingen's bullshit claim: And they're both very successful at what they're trying to do.

      WRONG. They're essentially the only options available. That's not a sign of "success". Given all the problems people have with them, it's proper to classify them as failures.

      dingen's bullshit claim: Sure there are problems, sure there are things wrong with it, but show me something perfect.

      WRONG. There aren't just "problems". The technologies entirely consist of problems, and entirely exhibit problems. The only type of "perfection" they attain is being perfectly imperfect.

      dingen's bullshit claim: There are two types of languages you know: ones everybody complains about and ones nobody uses.

      WRONG. Wrong, Bjarne. There are languages that smart people use, just because they don't have to constantly complain about them. Python is a good example. JavaScript is not. And HTML and CSS aren't even programming languages, so what you quoted doesn't even apply here!

      dingen's bullshit claim: I have no idea what you mean by "embedded Javascript", but Javascript is the programming language of the web.

      WRONG. No, C and C++ are the programming languages of the Web. They power the operating systems, web servers, database systems, networking devices, high-level server-side programming languages, web browsers, and even the JavaScript implementations used today. JavaScript is a minor client-side player, at best.

      dingen's bullshit claim: Contrary to HTML and CSS, Javascript is a "real" programming language by any definition.

      WRONG. JavaScript is not a programming language. It's a stretch to even call it a scripting language. It's clearly lacking too many critical features to be considered a real programming language.

      dingen's bullshit claim: Without it web applications would not be possible and the web would merely be a document system.

      WRONG. This is by far the most incorrect thing you have said so far. Surprisingly capable web applications existed before JavaScript was first released in 1995, and even well after that, when people were still using browsers that did not support JavaScript. Furthermore, there's nothing stopping browser developers from embedding other languages in their browsers. I suppose you've never used VBScript with Internet Explorer. JavaScrip

    6. Re:No , sorry. by dingen · · Score: 1

      Sure, HTML used to include tags for styling in the past. There was a time before CSS was invented and people wanted to make things look pretty after all. But these sort of tags have been regarded deprecated for at least a decade now.

      --
      Pretty good is actually pretty bad.
    7. Re:No , sorry. by dingen · · Score: 1, Funny

      This post is awesome! I'm saving it for later, thanks!

      --
      Pretty good is actually pretty bad.
    8. Re:No , sorry. by Jason+Levine · · Score: 1

      CSS isn't a nasty hack, it's a necessity. Take a look at CSSZenGarden.com. Every time you switch to a different theme, the HTML remains the same. All that changes is the CSS file (and the images that it references). To do that with plain HTML and no CSS, you would need tags or attributes to represent each display style. This would mean changing the look of a page would require completely recoding it instead of simply updating the stylesheet. If you wanted to, for example, make all links red instead of blue you would need to edit every link instance on your website. This would take a lot more time than loading the CSS file and changing a { color: #00F; } to a { color: #F00; }. It would also make things like WordPress themes nearly impossible.

      CSS makes modern web programming possible. Could it be improved? Definitely, but I couldn't imagine trying to create or update websites without it.

      --
      My sci-fi novel, Ghost Thief, is now available from Amazon.com.
    9. Re:No , sorry. by Viol8 · · Score: 1

      "This would mean changing the look of a page would require completely recoding it instead of simply updating the stylesheet."

      And it would be impossible to update the syntax of HTML to allow one piece of HTML to reference another piece in a seperate file why exactly?

    10. Re: No , sorry. by RaceProUK · · Score: 1

      All true. Those tags are still found in the wild though.

      --
      No colour or religion ever stopped the bullet from a gun
    11. Re:No , sorry. by amicusNYCL · · Score: 1

      That page has 5 pieces of red text saying that the font tag is not supported in HTML5. It tells you to use CSS instead. It says that it was deprecated in HTML 4.01. The font tag is an example of people realizing their mistakes, not a reason to bash modern HTML. Even W3Schools, with all of its problems and outdated tutorials, makes sure people know that.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
    12. Re: No , sorry. by RaceProUK · · Score: 1

      So you're saying no-one uses the font tag anymore? You have way too much faith in web developers.

      --
      No colour or religion ever stopped the bullet from a gun
    13. Re: No , sorry. by amicusNYCL · · Score: 1

      So you're saying no-one uses the font tag anymore?

      No, I'm saying that no competent teacher is teaching anyone to use a font tag in order to specify how text should look in a web page. As for faith in web developers, I think I'm pretty acquainted with beginner developers, I have more posts than anyone else in the W3Schools forum trying to help teach people and answer their questions. I'm surprised the people running the site finally managed to update their PHP/MySQL tutorials to use the mysqli extension instead of mysql, they were using those examples forever.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  9. Re:Is this a joke? by dingen · · Score: 1

    Why has functional - which is only midly declarative anyway but we'll let that slide - taken over the world like its proponents constantly tell us it will?

    Don't you mean "why *hasn't* functional programming taken over the world"?

    Anyway, it has. It's called Javascript and it's *huge*.

    --
    Pretty good is actually pretty bad.
  10. Re:!Like by dingen · · Score: 1

    I don't think so. The fact that it's code doesn't make it programming.

    --
    Pretty good is actually pretty bad.
  11. Re:By itself, I agree CSS is a good domain languag by dingen · · Score: 2

    It sounds like your'e confused. And I can't blame you, because there are *a lot* of different languages and syntaxes involved in creating a web application these days and it can be challenging to grasp it all. It helps to separate things in your mind. Even though the syntax of e.g. a JSON file may look a bit like a CSS file, they are completely unrelated. Make sure you know what you're working on (structure, style, client side logic, server side logic) and only concern yourself with the things that are related to that, nothing else. PHP for example has nothing to do with anything on the client, so don't even realize it exists when you're working on something in the client :-)

    --
    Pretty good is actually pretty bad.
  12. Re:Is this a joke? by cyber-vandal · · Score: 1

    It has the "function" keyword duh!

  13. Re:Is this a joke? by dingen · · Score: 3, Informative

    Javascript is much more a functional programming language than a procedural one. It's by no means as pure as Haskell, but this also allows it to be useful.

    I suggest you read up on some of the articles by Douglas Crockford, who does an awesome job of explaining the true nature of Javascript to the world. This is a good starting point.

    If you don't believe Javascript is indeed a functional programming, here is a Google Talk by the same Douglas Crockford explaining how to do monads in Javascript: http://www.youtube.com/watch?v=b0EF0VTs9Dc

    --
    Pretty good is actually pretty bad.
  14. Re:What? by BasilBrush · · Score: 1

    Um, no. MVC is a design pattern (i.e. a set of concepts for programming) that can apply to any language, CSS is declarative style markup (that apparently some people think should be the next programming language) that depends upon another markup language (HTML, XML).

    I'm happy that you know that. It's a shame you don't have the comprehension ability to see that nothing in my post said otherwise.

    I think you should look up MVC.

    I thing you should try teaching your grandmother to suck eggs.

  15. Re:!Like by Rich0 · · Score: 3, Funny

    Bollocks. CSS was designed to separate styling from structure in web pages. It does this admirably, and only needs to be a declarative language to do so.

    Bollocks. Every configuration file should be Turing complete. -- The Sendmail Authors.

  16. Re:!Like by dingen · · Score: 1

    I guess you're right. I was thinking of things like Turing-completeness, but I agree that is not actually necessary to make something a programming language. A player piano isn't a computer, but making a piano roll still is a form of programming.

    --
    Pretty good is actually pretty bad.
  17. Re:What? by Anonymous Coward · · Score: 1

    I think you missed the point of what BasilBrush was saying. Also, HTML/CSS/JS fit the MVC design pattern surprisingly well - the HTML is your data (model), the CSS is your view (in the sense that it controls presentation) and the Javascript is your controller (in the sense that it controls the application logic). It's just an analogy but surprisingly not far of the truth.

  18. Re:Is this a joke? by dingen · · Score: 1

    I know you're mocking, but in Javascript a function is a first class citizen. You can pass functions as parameters, return functions, keep them in a variable, create them at run-time. The fact Javascript has a curly braces syntax doesn't mean it can't be a functional programming language.

    --
    Pretty good is actually pretty bad.
  19. Re:!Like by Sique · · Score: 1

    The fact that it is interpreted by the browser and applied to the web page layout does.

    No, it doesn't. CSS is a description language, not a programming language. It just maps elements to the layout of said elements. Calling CSS a programming language would be akin to claiming, the mapping of numbers to colors in a paint-by-numbers would "program" the picture.

    --
    .sig: Sique *sigh*
  20. Re:By itself, I agree CSS is a good domain languag by Bazman · · Score: 1

    No, a JSON file looks nothing like a CSS file, it looks a lot like a chunk of javascript though....

  21. Practically Worthless. by VortexCortex · · Score: 3, Insightful

    Think about it. It's practically worthless. We might as well be compiling CSS + HTML + JS into an interactive PDF format for all the times we actually reskin entire sites. Even mobile stuff is suspect -- I mean, yeah, I can have 10 different images to serve depending on the size of the display, and I automate that image asset generation... Then what? I make the images be CSS backgrounds? Isn't that defeating the point of separating the style from the content? Go the other way: Actually put the content wholly in the HTML, and only use CSS to style everything. Yeah, great, I can sort of reskin for printers and mobiles, but where's the detection mechanism? It's on the server side... Thus conflating the whole model, view, controller and the presentation, content, style, etc. I mean, JS to manipulate the view -- So, what, a segmented controller? CSS3 Animation instead? Oh, so that's a style thing now. Bah, whatever. A rose by any other name...

    The problem is that designers would love to think these problems can be isolated and are separable. The reality is that they are not. Concentrating on making your CSS super flexible with selectors is merely mental masturbation. If it weren't then folks would be making CSS libraries for pulling off common styles and effects. Go to the "poster child" of CSS: CSS Zen Garden, and see for yourself. Tons of #id tags, tons of different designs, no one really taking any two designs and combining them with ease...

    The reality of the situation is that the next person who comes along will just scrap the whole thing and re-make the design again anyway (yes, even if that person is you). Might as well be compiling it all down into a low level colored shape display system, that way we can implement CSS and HTML and even new markups atop it, instead of waiting for OVER HALF the age of the web just to move from HTML4.01 to HTML5...

  22. Re:!Like by gl4ss · · Score: 1

    if it only included a #define....

    --
    world was created 5 seconds before this post as it is.
  23. CSS is great, unfortunately designers can't use it by Bitsy+Boffin · · Score: 3, Insightful

    CSS is great when used properly (although, somewhat hereticly, I would kill for definable constants a-la 'color: PRIMARY_WEBSITE_COLOR;' without resorting to dynamically writing the CSS ).

    Unfortunately graphic (website) designers are completely shit at using it. Even simply understanding when they should use an ID and when they should use a class seems to a'splode their brain, "huh, what is wrong with using this same id a bajillion times in the page". Don't even try telling them that "redtext" is not a good classname. Heck half of the time it's ".span1"!

    They don't even know (even after telling them half the time) that you can use multiple classes on a single element, let alone combine selectors, everything is a single ID or classname to them. The amount of copy-paste in most web designer's stylesheets is simply offensive, all because their brains don't allow them to modularise their desires into useful reusable CSS classes. Cascade? Inheritance? These are foreign words to the average website designer.

    There is no point telling a designer how they should can make their CSS better, they just won't understand. Worse, if the programmer, who does know how to use CSS as it was intended, attempts to fix their stylesheets (or worse, cut up their photoshops into proper HTML and CSS), the original designer just won't understand how to do anything in the stylesheet anymore.

    --
    NZ Electronics Enthusiasts: Check out my Trade Me Listings
  24. CSS should be a programming language by quietwalker · · Score: 3, Interesting

    Intellectually, I know that if it were more complex, there's no way it would have seen widespread adoption, and that markup is actually still complicated for many people. I can even look back at the early days of the web, when Marc Andreessen butted heads with Tim Berners-Lee about the media tag meant to display images, sounds, video and anything else and said, 'Screw it, you guys take too long to decide anything and it's over complicated, here's an img tag, done.' - and I can see how simple beats theoretically perfect and well designed.

    However, we're already at the point of widespread adoption now, and it's a good time to have a new css that actually is a programming language, with flow control, dynamic calculations of element values, and so on. This is what we need to provide real separation between the document and how it looks. Anyone experienced enough to write non-trivial web applications that are meant to be run on a browser, tablets of varying sizes (including accounting for reorientation), and even cell phones knows that it's unrealistic to use a single page - you get sent to the 'mobile' variant of the page or elsewhere.

    Css has been around for 16 years and it still lacks the ability to easily declare a completely separate layout based on display height or width, something like "If width is less than _x_, use this css, else this" or "set width equal to - 30". If you want those things now, you have to use javascript, and it's sometimes pretty awkward - like calculating the width of an element filled with content prior to displaying it.

    To you folks who cite javascript to fix this, realize that css no longer manages the document display at that point, the javascript does. That means that css is missing something required to manage a display. It can only do some of it's job.
            - side thought; I'd be happy if css allowed javascript within the css. Assign values based on closures or predefined functions. Simple fix -

    1. Re:CSS should be a programming language by quietwalker · · Score: 1

      Also, to you folks who are pants-on-the-head retarded, and think that html, css, and js equals an mvc, you are incredibly wrong. Javascript plus css is what defines the view, and that goes for all javascript outside of a few frameworks like Backbone that actually implement a real Controller pattern.

    2. Re:CSS should be a programming language by Jason+Levine · · Score: 5, Informative

      Css has been around for 16 years and it still lacks the ability to easily declare a completely separate layout based on display height or width, something like "If width is less than _x_, use this css, else this" or "set width equal to - 30". If you want those things now, you have to use javascript, and it's sometimes pretty awkward - like calculating the width of an element filled with content prior to displaying it.

      Actually, you can do that. I do it all the time when I use responsive web design. Here's some sample CSS code:

      @media screen and (min-width: 501px) and (max-width: 750px) { /* Put styles in here to reformat the page for larger tablets or small desktop resolutions */
      }

      @media screen and (max-width: 500px) { /* Put styles in here to reformat the page for mobile devices and small tablets */
      }

      @media print { /* Put all of your styles in here to format the page for printing. */
      }

      There is no JavaScript at work here. If you loaded a page utilizing this code in Chrome or FireFox (or IE10), disabled JavaScript, and resized the browser to make it smaller, you'd see the page slowly transform from a desktop version to a tablet version to a mobile version. (A good example of this is the Boston Globe's website: http://www.bostonglobe.com/ ). I can set styles for HTML elements and override them if certain conditions are met (max-width is between 2 values, screen resolution is a certain amount, print vs screen, etc). It might not be "if-then" statements, but it has the same effect.

      --
      My sci-fi novel, Ghost Thief, is now available from Amazon.com.
    3. Re:CSS should be a programming language by dingen · · Score: 1

      Css has been around for 16 years and it still lacks the ability to easily declare a completely separate layout based on display height or width, something like "If width is less than _x_, use this css

      Erm... heard of media queries? They do exactly this.

      @import url(narrow.css) (min-width:800px);

      This loads stuff from narrow.css and applies it if your window is less than 800px wide.

      --
      Pretty good is actually pretty bad.
    4. Re:CSS should be a programming language by OakDragon · · Score: 1

      I don't have mod points right now, so let me just say thanks for pointing that out. The Boston Globe's site is really neat when you re-size.

    5. Re:CSS should be a programming language by quietwalker · · Score: 1

      I have used media queries, and they are a great addition that gets us another step closer, but they're not the end-all, be-all. Once all the mobile devices can settle down and give us consistent and sane implementations (like not downloading every image, even those outside of the @media block), we'll be even better off, but it's still not a solution to each of my issues. Providing for statement evaluation, flow control, variables, and so on will.

      As someone who's actually written desktop apps, every time I write a webapp, I'm struck by the large number of unnecessary limitations - and I'm not talking about client-server interaction.

      I keep wishing for something similar to the java layout managers. The gridbaglayout - for all it's potential initial complexity - would be a boon to web application developers. Allowing an element to intelligently define it's attributes based on introspecting neighboring elements is incredibly powerful. I've been able to replicate some the functionality it provides with non-generic javascript triggering on resize or orientation change, but it's a pain, even with media queries.

      What I want to do is write one set of rules, once, for how a given element should display, and media queries ends up making me write multiple separate and distinct sets of rules, which makes it harder to maintain. Anyone who's sat down and refactored CSS and the related javascript associated with a website with multiple developers knows what I'm talking about. Heck, anyone who's sat down and written the CSS to include active tab highlighting (tab for current page or menu item is visually different than the rest) knows about the sort of things you need to do to both the page and the css to get it to work.

      Looked at from another way: there's a whole series of problems relating to layout and positioning, using the current system. It is totally possible to work around it now, using increasingly complex css and javascript, and in the future, using additions to CSS markup that result in the markup language slowly accreting layers of complexity. We could also just skip to the end and add standard programming features to CSS, allow for backwards compatibility, and be there already. We -should- be there already. Instead, we have pages full of 'CSS tricks' for standard layouts like liquid three columns that rely on browser-specific features or HTML-modification like unnecessary element encapsulation in outer and inner divs.

    6. Re:CSS should be a programming language by quietwalker · · Score: 1

      Actually, I see CSS as it stands now as the sendmail problem. Trying to accomplish in markup what amounts to an if/then statement - much less flow control - is incredibly complex as the language is not well suited for it. At some point, it's easier to write a program to do it. In comparison to what a markup language would need to be to accomplish my daily goals while writing a webapp, a programming language would be more succinct without losing readability, explicit as opposed to derived, and easier to organize and thus maintain.

      I can completely understand that this could be an intimidating step to non-programmers. If all one knows is dreamweaver and photoshop, I'm sure the published CSS hacks make up their bible, and the limitations are not even questioned. To a programmer though, using CSS to describe an application's look and feel is like banging on a nuclear reactor with a stone tomahawk.

    7. Re:CSS should be a programming language by snadrus · · Score: 1

      Skip to the end:
      I'm grateful modern development doesn't "skip to the end" that involves adding maximum program-ability everywhere, because then "the cat's out of the bag" and they must support it forever deprecate errors. It's convoluted & could be simpler, but it's safer which allows things like multi-domain use without XSS risks.

      --
      Science & open-source build trust from peer review. Learn systems you can trust.
    8. Re:CSS should be a programming language by ShieldW0lf · · Score: 1

      The MVC pattern doesn't really fit into this realm at all. It has its place in developing standalone applications, but when you're dealing with multi-tiered web applications, it's a poor fit.

      The stuff you send to the client is your view. HTML, CSS, JavaScript, the whole shebang. The code that runs on the server is your controller. The database is your model.

      Modern MVC implementations on the web are like writing an emulator of a bygone age because the abstractions are comfortable even though they don't fit.

      --
      -1 Uncomfortable Truth
  25. Re:By itself, I agree CSS is a good domain languag by dingen · · Score: 1

    You can't deny there's a very similar syntax going on (blocks of key:value pairs encapsulated by curly braces). I believe Crockford himself even said he came up with JSON after staring at a CSS file and realizing it looks a lot like a Javascript object.

    --
    Pretty good is actually pretty bad.
  26. Re:What? by sg_oneill · · Score: 1

    Um, no. MVC is a design pattern (i.e. a set of concepts for programming) that can apply to any language, CSS is declarative style markup (that apparently some people think should be the next programming language) that depends upon another markup language (HTML, XML).

    No. He got it right.
    Done properly, HTML is semantic. Its data. Its not a neat paralllel to a model , but its in the ballpark.
    CSS is the layout, its a view. It takes the model and presents it.
    And Guess what Javascript is?!

    Now your getting it!

    --
    Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
  27. Re:!Like by CastrTroy · · Score: 1

    You're going on like the only alternative to MVC is stuffing everything in a single file. While those of us who have been doing web development long before the idea of MVC have been separating out the business logic from the web page for a long time. There was stuff like N-Tier architectures which did a pretty good job of separating out the data storage from the business logic from the presentation layer. Personally I find this to be a lot better than MVC, because I find that MVC links the presentation too much to the underlying structure of the data.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  28. Oops. by sidragon.net · · Score: 3, Insightful

    First, you lose credibility for linking w3schools.com. Professional web developers wouldn't be caught dead referencing them. Second, you're referencing a tag that's deprecated because of CSS. Professional web developers wouldn't be caught dead using a font tag (or any other stylistic tags for that matter).

    1. Re:Oops. by BitZtream · · Score: 1

      First, you lose credibility for linking w3schools.com. Professional web developers wouldn't be caught dead referencing them. [w3fools.com]

      Let me give you a hint.

      Professionals link to the information that presents their view point. Children make ignorant blanket comments about websites with clear useful practical value.

      You're statement proves you're just an arrogant prick who knows less than you pretend you do. When you start insulting perfectly valid reference material as if its beneath you, you make it clear you're over compensating for your own lack of ability.

      If you're insulting a site intended for beginners because its beneath you, that generally indicates you feel inferior to it. So basically, all your comment is doing is letting us know that you aren't even confident that you know more than a beginners tutorial website.

      Your statements reflect badly on you, your attitude and your abilities. In short, you've made it clear that you don't actually know if you know what you're talking about. You're just a newbie trying to pretend to be more than you are.

      Insulting people using valid reference material just makes you look ignorant and unskilled.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    2. Re:Oops. by sidragon.net · · Score: 1

      Your comment's an admission that you didn't read my supporting material--material that unequivocally demonstrates that W3Schools is full of junk information. Beginners should not be taught the wrong way to use a technology, and they should not be taught things that are outright false.

      I've been developing web applications for well over a decade. Try again.

  29. Re:!Like - Bollocks to your Bollocks by robmv · · Score: 1

    You are confusing structure with layout. Tables are a used to define document structure, when the data to display is tabular. to use tables to layout the document when the contents of the table is not tabular data is plain wrong!

  30. Re:CSS as DSL? by robmv · · Score: 1

    Yes, I am using it for an internal XML dialect that need styling and for which HTML is not appropriate. We use the Apache Batik internal CSS processor (because we are using Batik for their SVG support, no need for a duplicate CSS processor independent of Batik)

  31. Re:Is this a joke? by skids · · Score: 1

    The fact Javascript has a curly braces syntax doesn't mean it can't be a functional programming language.

    Actually the thing that makes a functional language a functional language has nothing to do with curly braces. The defining principle of functional languages is that you have to have special hacks built into the language that technically violate it's functionality in order to make it do anything -- eh -- functional -- due to the fact that side effects are the only useful way to get anything done.

  32. Not Just jQuery by BiggoronSword · · Score: 1

    There are other JavaScript frameworks, beside jQuery, that support CSS selectors. i.e. Prototype

    --
    interactive hologram, or it didn't happen.
  33. Re:CSS is great, unfortunately designers can't use by itsdapead · · Score: 2

    Unfortunately graphic (website) designers are completely shit at using it. Even simply understanding when they should use an ID and when they should use a class seems to a'splode their brain, "huh, what is wrong with using this same id a bajillion times in the page".

    If CSS did what it said on the tin - separated content from style and layout - then graphic designers wouldn't have to bother their little heads about this sort of thing because they wouldn't need to touch the semantically-marked-up HTML.

    Unfortunately, (a) CSS doesn't do what it says in the tin - changing the layout inevitably needs including exactly the right permutation of DIVs in the markup because CSS doesn't have any way of doing what every half-decent DTP package since PagerMaker 1.0 can do: defining a series of frames and specifying how text should flow between them - and (b) anybody who thinks style can be completely separated from content has spent too long reading & writing rigidly structured technical documents.

    Don't even try telling them that "redtext" is not a good classname.

    Hell no! Any idiot knows that a classname should be something semantic, like "rubric". ;-)

    --
    In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  34. Unrelated technologies??? by Viol8 · · Score: 1

    Wtf are you smoking? HTML used to do presentation. And there's no reason it still can't. Please feel free to give the exact reason for CSS having an entirely different syntax and structure to HTML when XML which can store far more complicated data than CSS manages to have a pretty similar one.

    1. Re:Unrelated technologies??? by dingen · · Score: 1

      HTML used to do presentation

      Yeah, over a decade ago. How is that even remotely relevant to the modern web?

      And there's no reason it still can't.

      All the formatting tags are dropped in the latest versions of HTML. You can only use them if you're stuck in the past.

      Please feel free to give the exact reason for CSS having an entirely different syntax and structure to HTML when XML which can store far more complicated data than CSS manages to have a pretty similar one.

      XML has a lot of cruft. Look at the difference in size between a JSON file and an XML file containing the same data. The same thing would apply to style sheets written in XML.

      Also: why do you think it would be beneficial to have more or less the same syntax for two completely different things? What would you gain by doing that? The fact CSS has a different syntax than HTML underlines the difference between the function of the two things. Isn't that a good thing?

      --
      Pretty good is actually pretty bad.
    2. Re:Unrelated technologies??? by BitZtream · · Score: 1

      XML has a lot of cruft. Look at the difference in size between a JSON file and an XML file containing the same data. The same thing would apply to style sheets written in XML.

      Assuming you use a standard 'format' for human readability in your CSS files, they should not be but a tiny bit larger than your CSS files. Otherwise you made the XML wrong.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
  35. Re:What? by Shados · · Score: 1

    While that has nothing to do with the original point the person was trying to make, keep in mind MVC is a very specific pattern, and the fact you have a model, a view and a controller is only a part of it. How you use them is also part of the pattern.

    You can have a model, a view, and a "controller" and end up with a MVP, an MVVM, or a variety of other patterns that have these 3 components in one form or another.

  36. Re:!Like by clevelandguru · · Score: 1

    I think MVC more like Model = JSON Data View = HTML+CSS Controller = JavaScript

  37. Relational? by Tablizer · · Score: 1

    Why not leverage people's existing SQL knowledge and create a relational-friendly DOM? There will still be tree-oriented nesting, but special functions and views can assist with that.

  38. The problem is by kilodelta · · Score: 1

    That CSS is not programming at all. It's layout design.

  39. Re:Is this a joke? by kwerle · · Score: 1

    If javascript is a functional language (because you can do monads?), then I guess C is also a functional language.

    I think the definition of functional programming languages is more about what you can't do than what you can do - since they're all turing complete...

    Hell, javascript functions don't even return a value by default. To me that screams *not a functional language*.

  40. Re:box-sizing by itsdapead · · Score: 1

    The CSS property you're looking for is box-sizing. If you want modern browsers to use IE's box model where the width includes border and padding, use the value 'border-box'.

    Yes - but is it supported by IE7...

    If you want to yell at someone, yell at those folks still XP and IE8 (or earlier).

    Unfortunately, such folks fall into categories like "clients", "customers" or "target audience" and its not such a good idea to tell them "piss off and come back when you've got a decent web browser".

    This does all get better the further IE6/7/8 fade into history - if I were starting a site today I could at least ignore IE6/7 - but I'm still seeing significant hits from IE8.

    Then new things come along: I was having trouble with 'background-size' recently (handy if you want to use 2x res images to look good on 'retina'-type displays) and I've yet to find a browser that properly supports page-break controls on printouts (yes, I know people who like to print out web pages to read later).

    --
    In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  41. CSS selectors actually work?! by WaffleMonster · · Score: 1

    Every few years I crawl out of my sandbox and absorb any useful changes in the browser scene.

    The last time I tried CSS selectors every one I wanted to use either didn't work at all or worked great until I tried the same thing in a different browser.

  42. Re:box-sizing by amicusNYCL · · Score: 1

    The CSS property you're looking for is box-sizing. If you want modern browsers to use IE's box model where the width includes border and padding, use the value 'border-box'.

    Yes - but is it supported by IE7...

    Does IE7 support the IE box model? I'm not sure, I'll have to get back to you on that one.

    Unfortunately, such folks fall into categories like "clients", "customers" or "target audience" and its not such a good idea to tell them "piss off and come back when you've got a decent web browser".

    That's true, it wouldn't be a good idea to tell them to "piss off". It would be better to just tell them that they are using an unsupported browser that no longer receives testing, and they can either upgrade their browser or pay extra to test on legacy software. That sounds a little better than "piss off".

    --
    "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  43. Re:box-sizing by dingen · · Score: 1

    Forget about IE7. Apart from some corporate environments with which you don't want to have to deal with anyway, nobody is using that browser anymore. IE8 is the absolute minimum these days. Just another year and non-HTML5 compliant browsers will be a thing of the past. Finally.

    --
    Pretty good is actually pretty bad.
  44. Re:!Like - Bollocks to your Bollocks by dingen · · Score: 1

    If you think CSS interferes with structure, you don't understand what structure is. CSS is only about how things look, nothing more. HTML used to do style too in a distant past and there are a few remains of that still in there (some form elements for example have their own style which can't really be changed through CSS). But the other way around? No way.

    --
    Pretty good is actually pretty bad.
  45. Re:CSS as DSL? by bad-badtz-maru · · Score: 1

    Adobe's Flex platform uses (or used?) it for styling Flash GUI elements.

  46. Re:box-sizing by BitZtream · · Score: 1

    Unfortunately, such folks fall into categories like "clients", "customers" or "target audience" and its not such a good idea to tell them "piss off and come back when you've got a decent web browser".

    A few years ago, I'd agree with you. Now? You can let those 3 clients go, you won't miss them that much. If you tell them to go piss off, they'll come back, no one else is going to support them either.

    IF your business depends on old IE users for survival, you're fucked anyway, by definition.

    --
    Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
  47. Re:!Like - Bollocks to your Bollocks by BitZtream · · Score: 1

    You're confusing the point.

    The point is to get a job done. You're just adding unneeded semantics based on a broken philosophy. CSS is not better in several instances. Table based layouts are the proof of that. Instead of recognizing shortcomings, you're ignorance shows through as you just keep parroting the same old tired line ... which just goes to illustrate that you are having a religious debate about your preferred language rather than a discussion of technical merits.

    --
    Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
  48. Re:What? by BitZtream · · Score: 1

    And that really shows that while you understand the concepts of MVC, you don't understand what HTML actually is or how MVC exists in the real world.

    HTML is both data and view. CSS is just sorta view. and javascript is just control (usually coupled with a backend component to complete this part of MVC).

    The real world and the theoretical/ideal are entirely different.

    --
    Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
  49. Re:!Like - Bollocks to your Bollocks by robmv · · Score: 1

    getting the job done, the wrong way. Looks like you never cared about assistive technology and people that need it. A table is a table, a definition for tabular data, using tables for other things break the correct dictation/help the assistive technology provides. Content and presentation should be separated, period.

  50. Why don't we just fix the IMG tag? by TheRealHocusLocus · · Score: 1

    To allow specifying a RECTangular section of the source image, so that one can place or stretch pieces of a single image that has a zillion different style elements in rectangular tiles like corners, line segments, icons etc. One image to load, one palette to manage, and all the clipped regions appear instantly, magically! Need to swap 'styles'? Change the whole image! Need to extend the style? Build out tiles within the image in the X and Y directions! Use evil tables for everything without apology.

    Only joking! I wanted this in 1995. But instead of joining a standards committee I went and did other things for awhile. Well, I'm back.

    Only joking! Instead of improving the IMG tag, why don't we create whole hidden empty html layers whose background images are the source image and make them invisible by default and slide them off the page.

    Only joking! How about a web page that loads with a pile of layer:visible crap in the middle of it, menus open and obliterating the content, and load an external Javascript routine from another domain to make it invisible or skitter it out of the way? Eventually.

    Only joking! How 'bout dem web pages that dynamically resize themselves so that the rightmost or bottom portion of text is always hidden at every possible window size or display resolution? Select all, paste into Notepad to read it. Or better yet, paste it into a Java code development window and read it with all the colored blinking syntax violations.

    Only joking! I designed my whole site in Flash because with flash you can make round beeping web pages that have no volume controls.

    I run NoScript by default. More than half of the Internet is just missing. I run WebDeveloper and turn off CSS to view pages as Jesus would.

    Now awaiting the new specification for CCSS (Cascading Cascading Style Sheets). Under this progressive regime (CSS, CCSS, CCCSS etc) style is expected to overtake content by 2015, with content completely defecated by 2020.

    --
    <blink>down the rabbit hole</blink>
  51. Re:CSS is great, unfortunately designers can't use by jfengel · · Score: 1

    Wish I had mod points for your last sentence, but since I don't, I'll just let you know that I got the joke.

  52. Re:And javascript? by xombo · · Score: 1

    Yup. Welcome to the future :(

  53. Re:CSS is great, unfortunately designers can't use by Bitsy+Boffin · · Score: 1

    To an extent, but as another poster replied, it's more down to simply how the designer's brain works, can't blame them for that, but it doesn't make life easy.

    I think at the bottom of it is the common problem that CSS was developed by programmers, not designers, and the programmers didn't understand that the designers don't think like they do, and that they can't think like they do.

    As a result, it's just not a good fit for designers, so they use it badly.

    --
    NZ Electronics Enthusiasts: Check out my Trade Me Listings
  54. Re:box-sizing by itsdapead · · Score: 1

    Does IE7 support the IE box model? I'm not sure, I'll have to get back to you on that one.

    I did stop and think about that question a bit. Its not silly. IE7 can run in standards-compliant mode (CSS box-model) or legacy mode (IE box-model), depending on the doctype. The question is whether IE7 supports the "box-sizing" property in standards compliant mode, to enable the IE7 box model (which some people find more logical) without all the other IE quirks.

    --
    In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  55. Re:What? by BasilBrush · · Score: 1

    On that basis, it shows you don't understand metaphor.

    Though I'm sure you do, and just like to pick holes. Oops that was another metaphor.

  56. Re:!Like - Bollocks to your Bollocks by dingen · · Score: 1

    The job is not done when the site looks OK on your screen. The job is done when the Google bot can figure out your content so people will actually find your website.

    Putting everything inside a big table so it looks OK to humans won't help Google's robot (and the wrath of the blind will be upon you).

    --
    Pretty good is actually pretty bad.