Live data from Hacker News

Use spacer components instead of CSS margins (2020)

mxstbr.com

121–130 of 230 posts

Re: Use spacer components instead of CSS margins (2020)

#121

I do agree generally, but it's funny that the suggested solution (spacers) are basically back to the old 1px transparent gif trick from the 90s/early 00s. Nothing wrong with the suggestion, but it's just ironic that we seem to be coming full circle again. Next we'll probably have posts extolling components for layouts ;)

> but it's funny that the suggested solution (spacers) are basically back to the old 1px transparent gif trick from the 90s/early 00s.

I have to agree with others. It is not the same as 1px spacer hacks at all.

Re: Use spacer components instead of CSS margins (2020)

#122

I do agree generally, but it's funny that the suggested solution (spacers) are basically back to the old 1px transparent gif trick from the 90s/early 00s. Nothing wrong with the suggestion, but it's just ironic that we seem to be coming full circle again. Next we'll probably have posts extolling components for layouts ;)

My company recently had a FE candidate supply a test using tables.

There’s still a place for tables in some use cases. But that use case is thin.

Re: Use spacer components instead of CSS margins (2020)

#123

I do agree generally, but it's funny that the suggested solution (spacers) are basically back to the old 1px transparent gif trick from the 90s/early 00s. Nothing wrong with the suggestion, but it's just ironic that we seem to be coming full circle again. Next we'll probably have posts extolling components for layouts ;)

My company recently had a FE candidate supply a test using tables.

Serious question: What is inherently wrong with using Tables for organizing simple layouts? Is it frowned upon just because it is a "hacky" way of doing stuff?

Re: Use spacer components instead of CSS margins (2020)

#124

Needs (2020) in the title. Original discussion, 123 comments: https://news.ycombinator.com/item?id=22676442 Anyway, considered harmful articles considered harmful . There is a time and place for margins. Being thoughtful with them is a better approach than "banning margin from all components." Should I really ban the use of `margin-left: auto` when positioning my flexed elements? I don't think this article is actuall…

Still a useful article / discussion that belongs on HN IMO.

Re: Use spacer components instead of CSS margins (2020)

#125

Earlier quoted context omitted.

I hadn't heard of the owl selector for selecting :not(:first-child). Thank you for teaching me something new!

Note that the owl selector is pretty slow when it comes to being processed by browsers. If you use it sparingly, it shouldn't be so bad, but leave it all over the place, and you'll see the impact

Ha, when I first learned about it I remade a pretty interesting navigation menu purely with :not :checked :focused :hover etc, so pure html and css, thinking it would be more performant then my previous JS version.

Its performance was not just measurably worse, it was obvious as soon as I opened the revision on my phone.

Lesson learned: it's important to think twice before using most pseudo selectors

Re: Use spacer components instead of CSS margins (2020)

#126

I do agree generally, but it's funny that the suggested solution (spacers) are basically back to the old 1px transparent gif trick from the 90s/early 00s. Nothing wrong with the suggestion, but it's just ironic that we seem to be coming full circle again. Next we'll probably have posts extolling components for layouts ;)

Tendency towards semantic web is unfortunately dead. Now you have simple blogs rendered by shadow DOM components. Even with templates separation of template and code was ideal - now you have 'reusable components' with templates all over the place. Functional programming has its place, but I'm not sure if everywhere. (You can separate code from templates even with FP and React - but often it is not the case).

Re: Use spacer components instead of CSS margins (2020)

#127

Earlier quoted context omitted.

I hadn't heard of the owl selector for selecting :not(:first-child). Thank you for teaching me something new!

Note that the owl selector is pretty slow when it comes to being processed by browsers. If you use it sparingly, it shouldn't be so bad, but leave it all over the place, and you'll see the impact

Is there a place to see css benchmarks on modern browsers, like jsperf used to be for JS?

It seems like > *+*, *:not(first-child), *:nth-child(1+n) and *:last-child { ...revert... } are all equivalent. I would be curious to know which is most efficient.

Re: Use spacer components instead of CSS margins (2020)

#128

Earlier quoted context omitted.

My company recently had a FE candidate supply a test using tables.

Serious question: What is inherently wrong with using Tables for organizing simple layouts? Is it frowned upon just because it is a "hacky" way of doing stuff?

I think it would be hard to make it responsive. Also, table is a semantic element. You should use it unless you're displaying tabular data.

Re: Use spacer components instead of CSS margins (2020)

#129
post #67

Earlier quoted context omitted.

The problem with CSS, and HTML is that content structure, content layout, and its styling is intertwined like spaghetti. A ground up HTML rewrite is needed.

Are you saying that content and layout _should_ always remain combined? I accept that we come to this understanding through our early introduction to language, writing and art. Most people intuitively link structure and presentation when they compose content. Separating them is incredibly useful. You can see this at a really basic level, in plain text. Lay out a single long paragraph of plain text into lines of max 8…

XSLT is there, chrome supports it, but no progressive rendering, or support of modern XSLT versions.

Basically, Google wants to kill XSLT, and normal web in favour of Javascript, and WASM based web. Why? They don't want people to turn off javascripts, so they can show more ads, and competitors cannot get an easier job making google.com alternative.

Re: Use spacer components instead of CSS margins (2020)

#130
post #126

I do agree generally, but it's funny that the suggested solution (spacers) are basically back to the old 1px transparent gif trick from the 90s/early 00s. Nothing wrong with the suggestion, but it's just ironic that we seem to be coming full circle again. Next we'll probably have posts extolling components for layouts ;)

Tendency towards semantic web is unfortunately dead. Now you have simple blogs rendered by shadow DOM components. Even with templates separation of template and code was ideal - now you have 'reusable components' with templates all over the place. Functional programming has its place, but I'm not sure if everywhere. (You can separate code from templates even with FP and React - but often it is not the case).

>Tendency towards semantic web is unfortunately dead.

Not dead, but under severe attack. We can and will fightback

Post reply on HN