Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. CCS is worst language ever created

CCS is worst language ever created

Scheduled Pinned Locked Moved The Lounge
javascriptcsstutorialquestioncareer
45 Posts 26 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R raddevus

    bjoernen wrote:

    For example "the width of this element should be equal to half the width of that element"

    This kind of stuff is done using SASS (a CSS pre-compiler)[^].

    B Offline
    B Offline
    bjoernen
    wrote on last edited by
    #11

    I'm not talking about clever ways to generate complex CSS, I'm talking about expressing relationships between page elements that is not possible at all with current CSS. For example: "The height of element B is 1/10th of what ever the page height is at the moment. The width of element A should be equal to the height of element B, but only if B's height is less than 100px, in other case it should be half of the height of element B.". Here is how simple it could look in theory: B.height = PAGE.height / 10; A.width = B.height < 100px? B.height : B.height / 2;

    Bjorn

    R M D H 4 Replies Last reply
    0
    • B bjoernen

      No language has casued me more grief in my 30+ year career than CSS. It is almost like some form of black magic, where you can never be 100% sure what a page will look like. Even for the simplest designs you have to allocate 4 hours, just to make sure it looks the same in all browsers. Why the decision to write an enormously complex layout engine, and then keep adding more bloat to it every year? Why not let the page designer interact with the layout engine instead, as it is laying out the elements on the page? It could be done through JS calls, or even by writing simple math formulas into the CSS, that refer to the sizes of other elements. For example "the width of this element should be equal to half the width of that element". Then let the browser's layout engine simply be a multi variable equation solver. End of rant.

      Bjorn

      D Offline
      D Offline
      DerekT P
      wrote on last edited by
      #12

      bjoernen wrote:

      by writing simple math formulas into the CSS

      Like this[^], you mean? The calc() functions in CSS are useful, potentially (though I've not used them myself) but they don't directly include the ability to refer to other elements. However you can refer to CSS custom variables which may give you the flexibility you want. But hey, all this is just adding more bloat, and making it harder to learn (and test for cross-browser compliance). The trouble is, the features you want are not the same as the features someone else wants - and pleasing everyone is what leads to bloat in the first place. :(

      1 Reply Last reply
      0
      • B bjoernen

        I'm not talking about clever ways to generate complex CSS, I'm talking about expressing relationships between page elements that is not possible at all with current CSS. For example: "The height of element B is 1/10th of what ever the page height is at the moment. The width of element A should be equal to the height of element B, but only if B's height is less than 100px, in other case it should be half of the height of element B.". Here is how simple it could look in theory: B.height = PAGE.height / 10; A.width = B.height < 100px? B.height : B.height / 2;

        Bjorn

        R Offline
        R Offline
        raddevus
        wrote on last edited by
        #13

        I believe you are well on your way to the next programming language, scripting language, standard. :) Here is your guidance... xkcd: Standards[^]

        1 Reply Last reply
        0
        • B bjoernen

          I'm not talking about clever ways to generate complex CSS, I'm talking about expressing relationships between page elements that is not possible at all with current CSS. For example: "The height of element B is 1/10th of what ever the page height is at the moment. The width of element A should be equal to the height of element B, but only if B's height is less than 100px, in other case it should be half of the height of element B.". Here is how simple it could look in theory: B.height = PAGE.height / 10; A.width = B.height < 100px? B.height : B.height / 2;

          Bjorn

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #14

          The reason stuff like that isn't possible is because you will get endless recursion. Let's say you have:

          The height of B is determined by the content of A, but if you are changing the width of A based on the height of B then the height of A will also change, which in turn forces the height of B to change, which would then require the width of A to change, which will once again change the height of B, and the loop continues until you get a StackOverflow exception. So perhaps you say: "Well, don't allow rules like that", but then you end up with even more of a headache trying to make sure your rules don't conflict with other rules. Put it this way, if it was possible to make it work well then it would for sure already exist. As the saying goes: if you have a good idea, it either already exists or it really isn't that good an idea.

          J B 2 Replies Last reply
          0
          • B bjoernen

            No language has casued me more grief in my 30+ year career than CSS. It is almost like some form of black magic, where you can never be 100% sure what a page will look like. Even for the simplest designs you have to allocate 4 hours, just to make sure it looks the same in all browsers. Why the decision to write an enormously complex layout engine, and then keep adding more bloat to it every year? Why not let the page designer interact with the layout engine instead, as it is laying out the elements on the page? It could be done through JS calls, or even by writing simple math formulas into the CSS, that refer to the sizes of other elements. For example "the width of this element should be equal to half the width of that element". Then let the browser's layout engine simply be a multi variable equation solver. End of rant.

            Bjorn

            C Offline
            C Offline
            Chris Maunder
            wrote on last edited by
            #15

            It's a language by committee. And a committee made up of teams that are actively competing with each other. Read this discussion on CSS4[^]. They actually, deliberately, don't want to increment the CSS version anymore. That's like macOS stopping at version 10 (...but instead is 10.1, 10.2 etc), and Windows 10 stopping at 10. Or 10 20H1, 20H2...) I think the hardest part of CSS is the "C" - the cascading, which relies on Specificity. It's super logical and very well defined. And an utter nightmare as soon as you step off the beaten track. Switch elements around, decide you need some special formatting, try and generalise it, and boom! Still - it does at least attempt to encourage a separation of layout and style. Except the CSS defines the layout :doh:

            cheers Chris Maunder

            W B 2 Replies Last reply
            0
            • M musefan

              The reason stuff like that isn't possible is because you will get endless recursion. Let's say you have:

              The height of B is determined by the content of A, but if you are changing the width of A based on the height of B then the height of A will also change, which in turn forces the height of B to change, which would then require the width of A to change, which will once again change the height of B, and the loop continues until you get a StackOverflow exception. So perhaps you say: "Well, don't allow rules like that", but then you end up with even more of a headache trying to make sure your rules don't conflict with other rules. Put it this way, if it was possible to make it work well then it would for sure already exist. As the saying goes: if you have a good idea, it either already exists or it really isn't that good an idea.

              J Offline
              J Offline
              Jorgen Andersson
              wrote on last edited by
              #16

              musefan wrote:

              As the saying goes: if you have a good idea, it either already exists or it really isn't that good an idea.

              Luckily everyone doesn't think like that, otherwise all development would stagnate.

              Wrong is evil and must be defeated. - Jeff Ello

              W M 2 Replies Last reply
              0
              • J Jorgen Andersson

                musefan wrote:

                As the saying goes: if you have a good idea, it either already exists or it really isn't that good an idea.

                Luckily everyone doesn't think like that, otherwise all development would stagnate.

                Wrong is evil and must be defeated. - Jeff Ello

                W Offline
                W Offline
                W Balboos GHB
                wrote on last edited by
                #17

                A proper upvote for that!

                Ravings en masse^

                "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                1 Reply Last reply
                0
                • C Chris Maunder

                  It's a language by committee. And a committee made up of teams that are actively competing with each other. Read this discussion on CSS4[^]. They actually, deliberately, don't want to increment the CSS version anymore. That's like macOS stopping at version 10 (...but instead is 10.1, 10.2 etc), and Windows 10 stopping at 10. Or 10 20H1, 20H2...) I think the hardest part of CSS is the "C" - the cascading, which relies on Specificity. It's super logical and very well defined. And an utter nightmare as soon as you step off the beaten track. Switch elements around, decide you need some special formatting, try and generalise it, and boom! Still - it does at least attempt to encourage a separation of layout and style. Except the CSS defines the layout :doh:

                  cheers Chris Maunder

                  W Offline
                  W Offline
                  W Balboos GHB
                  wrote on last edited by
                  #18

                  Chris Maunder wrote:

                  that's like macOS stopping at version 10 (...but instead is 10.1, 10.2 etc), and Windows 10 stopping at 10. Or 10 20H1, 20H2...)

                  . . . . perchance to dream . . . .

                  Ravings en masse^

                  "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                  "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                  1 Reply Last reply
                  0
                  • J Jorgen Andersson

                    musefan wrote:

                    As the saying goes: if you have a good idea, it either already exists or it really isn't that good an idea.

                    Luckily everyone doesn't think like that, otherwise all development would stagnate.

                    Wrong is evil and must be defeated. - Jeff Ello

                    M Offline
                    M Offline
                    musefan
                    wrote on last edited by
                    #19

                    Jörgen Andersson wrote:

                    Luckily everyone doesn't think like that

                    Indeed, most people don't even think at all... But I don't particularly agree that we only advance from unique ideas. I am sure a lot of people come up with the same ideas all the time, it's just who gets to market first, so to speak.

                    J 1 Reply Last reply
                    0
                    • M musefan

                      Jörgen Andersson wrote:

                      Luckily everyone doesn't think like that

                      Indeed, most people don't even think at all... But I don't particularly agree that we only advance from unique ideas. I am sure a lot of people come up with the same ideas all the time, it's just who gets to market first, so to speak.

                      J Offline
                      J Offline
                      Jorgen Andersson
                      wrote on last edited by
                      #20

                      musefan wrote:

                      who gets to market first

                      Word. Edison comes to mind.

                      Wrong is evil and must be defeated. - Jeff Ello

                      1 Reply Last reply
                      0
                      • M musefan

                        The reason stuff like that isn't possible is because you will get endless recursion. Let's say you have:

                        The height of B is determined by the content of A, but if you are changing the width of A based on the height of B then the height of A will also change, which in turn forces the height of B to change, which would then require the width of A to change, which will once again change the height of B, and the loop continues until you get a StackOverflow exception. So perhaps you say: "Well, don't allow rules like that", but then you end up with even more of a headache trying to make sure your rules don't conflict with other rules. Put it this way, if it was possible to make it work well then it would for sure already exist. As the saying goes: if you have a good idea, it either already exists or it really isn't that good an idea.

                        B Offline
                        B Offline
                        bjoernen
                        wrote on last edited by
                        #21

                        What you describe already happens in the layout engine of modern browsers. The rules that I outlined earlier already happen, but is invisible to us. There are hundreds of such rules that must be evaluated to produce the final layout, and some are in direct conflict with each other, so the engine is designed to make a compromise. These compromise heuristics is what avoids endless recursion. So imagine that tomorrow the Google Chrome team launches a new module called JSCSS, were they have moved out all those heuristics from inside the layout engine and written them in JS. From now on you point to a JSCSS file at the beginning of a HTML page, which defines all the CSS rules you intend to use. CSS still works exactly like before. But the HUGE difference is, now you can see how a flexbox actually figures out layout, AND you can extend CSS with your own definitions for things you think is better than the standard. AND you can omit CSS altogether, and write your layout directly in JSCSS of you want. This would be a huge relief for everyone, because browser makers only have to make sure the core layout engine works correctly, and every CSS definition is in external JS, exactly the same for every browser. And any developer can extend CSS with his own definitions.

                        Bjorn

                        1 Reply Last reply
                        0
                        • C Chris Maunder

                          It's a language by committee. And a committee made up of teams that are actively competing with each other. Read this discussion on CSS4[^]. They actually, deliberately, don't want to increment the CSS version anymore. That's like macOS stopping at version 10 (...but instead is 10.1, 10.2 etc), and Windows 10 stopping at 10. Or 10 20H1, 20H2...) I think the hardest part of CSS is the "C" - the cascading, which relies on Specificity. It's super logical and very well defined. And an utter nightmare as soon as you step off the beaten track. Switch elements around, decide you need some special formatting, try and generalise it, and boom! Still - it does at least attempt to encourage a separation of layout and style. Except the CSS defines the layout :doh:

                          cheers Chris Maunder

                          B Offline
                          B Offline
                          bjoernen
                          wrote on last edited by
                          #22

                          Yea I wish CSS was only about style, and layout was handled in a different way. I think it is possible to keep the core layout engine of the current browsers, and create a kind of scripting language they can run, so the developer can interact with the layout procedure. These ideas have been proposed before, so I can't understand why we still have CSS today. I was cursing HTML layout 15 years ago, and couldn't imagine we would still be doing things the same way today. Some developments in this space have been amazing, but HTML/CSS/JS has really been a disappointment. There is still not a practical way to write C# and run it in the browser, just promises of WASM and compilers that never hit mainstream.

                          Bjorn

                          C 1 Reply Last reply
                          0
                          • B bjoernen

                            Yea I wish CSS was only about style, and layout was handled in a different way. I think it is possible to keep the core layout engine of the current browsers, and create a kind of scripting language they can run, so the developer can interact with the layout procedure. These ideas have been proposed before, so I can't understand why we still have CSS today. I was cursing HTML layout 15 years ago, and couldn't imagine we would still be doing things the same way today. Some developments in this space have been amazing, but HTML/CSS/JS has really been a disappointment. There is still not a practical way to write C# and run it in the browser, just promises of WASM and compilers that never hit mainstream.

                            Bjorn

                            C Offline
                            C Offline
                            Chris Maunder
                            wrote on last edited by
                            #23

                            bjoernen wrote:

                            compilers that never hit mainstream

                            You've not looked at Blazor[^]?

                            cheers Chris Maunder

                            1 Reply Last reply
                            0
                            • B bjoernen

                              No language has casued me more grief in my 30+ year career than CSS. It is almost like some form of black magic, where you can never be 100% sure what a page will look like. Even for the simplest designs you have to allocate 4 hours, just to make sure it looks the same in all browsers. Why the decision to write an enormously complex layout engine, and then keep adding more bloat to it every year? Why not let the page designer interact with the layout engine instead, as it is laying out the elements on the page? It could be done through JS calls, or even by writing simple math formulas into the CSS, that refer to the sizes of other elements. For example "the width of this element should be equal to half the width of that element". Then let the browser's layout engine simply be a multi variable equation solver. End of rant.

                              Bjorn

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #24

                              The fascination of presentation over content.

                              It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                              M 1 Reply Last reply
                              0
                              • L Lost User

                                The fascination of presentation over content.

                                It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                                M Offline
                                M Offline
                                Matthew Dennis
                                wrote on last edited by
                                #25

                                "The medium is the message"

                                "Time flies like an arrow. Fruit flies like a banana."

                                1 Reply Last reply
                                0
                                • B bjoernen

                                  No language has casued me more grief in my 30+ year career than CSS. It is almost like some form of black magic, where you can never be 100% sure what a page will look like. Even for the simplest designs you have to allocate 4 hours, just to make sure it looks the same in all browsers. Why the decision to write an enormously complex layout engine, and then keep adding more bloat to it every year? Why not let the page designer interact with the layout engine instead, as it is laying out the elements on the page? It could be done through JS calls, or even by writing simple math formulas into the CSS, that refer to the sizes of other elements. For example "the width of this element should be equal to half the width of that element". Then let the browser's layout engine simply be a multi variable equation solver. End of rant.

                                  Bjorn

                                  Sander RosselS Offline
                                  Sander RosselS Offline
                                  Sander Rossel
                                  wrote on last edited by
                                  #26

                                  I'm a simple man. I see CSS hate, I upvote.

                                  Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                                  J 1 Reply Last reply
                                  0
                                  • Sander RosselS Sander Rossel

                                    I'm a simple man. I see CSS hate, I upvote.

                                    Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                                    J Offline
                                    J Offline
                                    Jorgen Andersson
                                    wrote on last edited by
                                    #27

                                    This[^] is for you then. :-)

                                    Wrong is evil and must be defeated. - Jeff Ello

                                    Sander RosselS 1 Reply Last reply
                                    0
                                    • B bjoernen

                                      No language has casued me more grief in my 30+ year career than CSS. It is almost like some form of black magic, where you can never be 100% sure what a page will look like. Even for the simplest designs you have to allocate 4 hours, just to make sure it looks the same in all browsers. Why the decision to write an enormously complex layout engine, and then keep adding more bloat to it every year? Why not let the page designer interact with the layout engine instead, as it is laying out the elements on the page? It could be done through JS calls, or even by writing simple math formulas into the CSS, that refer to the sizes of other elements. For example "the width of this element should be equal to half the width of that element". Then let the browser's layout engine simply be a multi variable equation solver. End of rant.

                                      Bjorn

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #28

                                      CSS is not a language, it is markup.

                                      Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                      1 Reply Last reply
                                      0
                                      • J Jorgen Andersson

                                        This[^] is for you then. :-)

                                        Wrong is evil and must be defeated. - Jeff Ello

                                        Sander RosselS Offline
                                        Sander RosselS Offline
                                        Sander Rossel
                                        wrote on last edited by
                                        #29

                                        I actually gave that on a mug to a designer, it's his favorite mug :D

                                        Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                                        1 Reply Last reply
                                        0
                                        • B bjoernen

                                          Thanks for the link, interesting read. If PSL96 had been implemented instead, CSS would be a lot easier. You simply express sizes of things in terms of sizes of other things. It would have resulted in a much smaller language, that most people could grasp. And people would create libraries of handy expressions that accomplish the very same things that flex and grid does today. With the huge difference that you can look at the code and see what happens. Right now it is just a back box that almost no one understands. Browser support would be easier and more uniform, not harder, because there is a smaller feature set to implement. Do you know of any other language where there is so low predictability of outcome? You basically spend your time trying 100 different tweaks until it looks right.

                                          Bjorn

                                          J Offline
                                          J Offline
                                          Jeroen_R
                                          wrote on last edited by
                                          #30

                                          bjoernen wrote:

                                          If PSL96 had been implemented instead, CSS would be a lot easier. You simply express sizes of things in terms of sizes of other things.

                                          That might work for basic stuff. Once you want to use different styles for different screen sizes, this becomes unworkable very quickly.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups