Live data from Hacker News

"CSS is dramatically more difficult than learning assembly language" [audio]

feeds.resonaterecordings.com

61–70 of 109 posts

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#61
CSS is difficult because the complexity and inconsistency of mixing the intrinsic styles of HTML tags and CSS styles.

For example, width can be set on but has no effect on . You have to set its display to inline-block.

Another example, has its default colors. Setting CSS colors on the parent element has no effect on the colors, which defeats the CASCADE nature in CSS. You have to apply the styling on . But some styles like font-size does get through from parents.

Another example, text overflows out of bound by default. You have to do the trick of turning off overflow. It feels like setting the bound has no effect.

CSS just has lots of inconsistencies and requires knowing many little tricks to use it effectively.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#62
post #51
post #32

I cannot look at a UI design and intuitively know what CSS attributes would generate that exact output. I think part of it for me is that I do not have an intuitive understanding of the box model and how layouts are calculated. On top of that, since CSS cascades, you have to be able to mentally keep track of all the parent attributes to understand how they affect a specific element on the page. I was working on a Rea…

> I ended up just playing around with putting attributes on various components until I found what worked. It's sometimes hard for me to wrap my head around flexbox as well. If you haven't already seen it, this page [0] is imo the flexbox bible. There's one for grid [1] too. [0] https://css-tricks.com/snippets/css/a-guide-to-flexbox/ [1] https://css-tricks.com/snippets/css/complete-guide-grid/

[deleted]

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#63
post #32

I cannot look at a UI design and intuitively know what CSS attributes would generate that exact output. I think part of it for me is that I do not have an intuitive understanding of the box model and how layouts are calculated. On top of that, since CSS cascades, you have to be able to mentally keep track of all the parent attributes to understand how they affect a specific element on the page. I was working on a Rea…

[dead]

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#64
post #61

CSS is difficult because the complexity and inconsistency of mixing the intrinsic styles of HTML tags and CSS styles. For example, width can be set on but has no effect on . You have to set its display to inline-block. Another example, has its default colors. Setting CSS colors on the parent element has no effect on the colors, which defeats the CASCADE nature in CSS. You have to apply the styling on . But some style…

> inconsistency of mixing ... width can be set on but has no effect on

One of these is a division of layout, one of these spans the thing it wraps. The should span the span of the content.

The affordance of an anchor hypertext reference was supposed to be consistent for usability, and the is on the link aspect, not on the text. The text that's inside the here is part of the text on either side of the anchor, and should of course reflect the font size etc., because the font applies to the text, while the style applies to the indication/affordance of anchorness. And, you can pick what you want the a to be given which division or span of content it's in, and the most specific style will apply:

https://jsfiddle.net/mD5us/4/

Arguably, both of these are not just consistent, but the way it should work in principle given the apples and oranges you're comparing.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#65

I don't understand the CSS confusion. Maybe because I've been doing it for 15+ years but it's extremely intuitive to me and I love working with it. Tailwind annoys me because it removes some of that flexibility / freedom for me to just solve a problem immediately with a new class or something.

I’m sure experience is part of it, but having worked with CSS since roughly 1996 I’ve noticed that there’s a heavy respect gradient where a lot of developers thought it’s beneath them, not a real language, etc. which is also shared with HTML, the layout model, etc.

None of that is universal, of course, and it’s not like CSS is perfect but the worst code I’ve seen was written in near-contempt by, for example, some dude who wrote many thousands of lines of … not brilliant … code to make a Java display framework because he refused to learn how CSS works. I was called in to that for performance reasons because if you don’t understand classes, you can end up with 20MB HTML responses with the same inline styles everywhere. That was an outlier but I’ve seen a lot of similar attitudes where someone shipped 4MB of JavaScript to avoid learning CSS positioning or tried to get a designer to edit their code because they thought adding IDs or making semantic, accessible markup was beneath them. One interesting social dynamic there has been the guys who simultaneously refused to deal with front end stuff but also didn’t think it should pay well, often with more that a whiff of sexism given how designer was coded female at those places.

That’s improved in some ways as front end work became more central in the SPA era but it’s still pretty easy to find people who’ll deploy enormous amounts of code to avoid using a builtin browser feature or whine about how “the DOM” is too slow as if it’s the browser’s fault they’re using React.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#66

Advanced results require advanced skills. CSS is one of my favorite languages. And the only way I can consider CSS to be difficult is if you have no experience with HTML. If you try to do HTML by hand, then doing CSS by hand on top of HTML by hand is really easy and wonderful. And this is truly where you gain the fundamental framework for "getting CSS".

Handcoding/server-generation HTML running CSS via SCSS with no frameworks is a truly fulfilling experience. Especially if I get to mix in some SVG. I'm one of the few that outright hates JS, so I'm always glad when I get a chance to get back to my favorites.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#67
post #32

I cannot look at a UI design and intuitively know what CSS attributes would generate that exact output. I think part of it for me is that I do not have an intuitive understanding of the box model and how layouts are calculated. On top of that, since CSS cascades, you have to be able to mentally keep track of all the parent attributes to understand how they affect a specific element on the page. I was working on a Rea…

Box model + flex box + the display modes + "positioning" (stacking contexts) are typically the most confusing parts of CSS, I feel. Add maybe margin and padding, and how they interact (margin collapse, no margin collapse in flex or grid context, box model again, auto values). But then, that's basically all the hard conceptual parts. But they are mostly intuitive and well-designed! I know I'm alone with this opinion.…

> Box model + flex box + the display modes + "positioning" (stacking contexts) are typically the most confusing parts of CSS, I feel.

That's like 90% of UI. Saying they are the most confusing parts of CSS is basically admitting that CSS is awful to learn and use.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#68
post #50

Earlier quoted context omitted.

There are Reasons(TM) for it. And yet when flexbox was created, there was no horizonal/vertical difference.

I'm not sure about that, flexbox has a major and minor axis, which you can define with flex-direction.

As I said, there is no inconsistent treatment of horizontal and vertical.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#69

Ok I dont have time to listen to the podcast, and could not figure out which one it refers to. But I'll bite on the headline. CSS is difficult because it was not designed with logic as input as a programming language. It was designed from expected print output. "I want to do this thing that is popular in New York Times magazine". Floats, run-in, first line, multi column. Static papers that were never meant to move ar…

That's not at all true - it took ages before CSS added multi-column layout.

Both can be true. It took long to make it into the specification yes.

But I am certain it was part of the original drafts. Just hard to implement so it got no extra push from the implementation side.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#70
post #61

CSS is difficult because the complexity and inconsistency of mixing the intrinsic styles of HTML tags and CSS styles. For example, width can be set on but has no effect on . You have to set its display to inline-block. Another example, has its default colors. Setting CSS colors on the parent element has no effect on the colors, which defeats the CASCADE nature in CSS. You have to apply the styling on . But some style…

> inconsistency of mixing ... width can be set on but has no effect on One of these is a division of layout, one of these spans the thing it wraps. The should span the span of the content. The affordance of an anchor hypertext reference was supposed to be consistent for usability, and the is on the link aspect, not on the text. The text that's inside the here is part of the text on either side of the anchor, and shou…

Yes. All these are "supposed" to work the way they are and they are given good reasons, but it still doesn't negate the facts that the same CSS style has different effects on different tags.

The tag is a good example. As a user of CSS, when I apply a width to a span, I want its width set. I don't care it spans items. If I want span to have no width, I would just leave it alone. The fact that setting the width spells my intention clearly to restrict its width.

In regarding to the selective application of colors and font-size on text, both the colors and font-size are styles that affect the text of the link. Why does one go through and the other doesn't? Don't you want consistent appearance of the link both in colors and font-size, in the name of affordance?

Post reply on HN