News for hackers. Stuff that matters.

criswell

This is a really cool idea. The use of custom attributes without `data-` before it makes me a little nervous. Is that a concern here? I saw `project` being used on elements and if that's officially used for something eventually can it muddy things up?
Re:Vanilla JavaScript support for Tailwind Plus on Monday July 28, 2025 @02:50PM (#44714000)
This takes away so many of the criticisms I see in this thread. The issue with Tailwind, and my only minor criticism, is just long, unreadable, not easy to deliminate lists of classes. This very easily takes care of that (and I use it for more complex class lists daily)
Re:Why do military personnel wear watches upside down? on Friday February 16, 2024 @01:09PM (#39400753)
If I didn't sit at a desk way too much I'd give it a shot. There seems to be some solid advantages.
Re:Google Chrome will limit ad blockers starting June 2024 on Tuesday November 21, 2023 @04:35PM (#38370591)
I really like Arc. Takes some getting used to but worth the adjustment I think.
"it's trivial to edit and add stuff, and requires basically no maintenance whatsoever."

What an absolute dream.

If every instinct you have is wrong, then the opposite would have to be right.
Re:Ask HN: Did JSON array order used to be a problem? on Friday May 05, 2023 @02:39PM (#35833474)
I don't recall that, just to not rely on the order of an object's keys, which appears to be outdated advice (at least for Javascript).

https://2ality.com/2015/10/property-traversal-order-es6.html

give me apache directory listing styled websites or give me death
Re:Help choose the syntax for CSS Nesting on Friday December 16, 2022 @09:09PM (#34023579)
I want to say this but too lazy to defend it.
Re:Adobe to acquire Figma for $20B on Thursday September 15, 2022 @09:00PM (#32860642)
This is why I'm so bummed by it.
Re:Play with TailwindCSS in the Browser on Friday June 10, 2022 @03:37PM (#31698511)
Intellisense would help a lot with this task: https://gist.github.com/crswll/db0d276bbf0884b003f3715d48e68...
Re:Play with TailwindCSS in the Browser on Friday June 10, 2022 @12:05PM (#31696033)
Looking forward to the takes on your 91st account.
Re:Play with TailwindCSS in the Browser on Friday June 10, 2022 @12:02PM (#31695997)
I know it's going to be abused to hell like everything popular but definitely a useful power tool.

It'll be really nice for container queries when they're ready. Something like: `wider-than-[500px]:hover:text-red-500` and so on.

Also super nice for `:has` (although ordering is a concern at the moment): `[:has(:invalid)]:bg-red-500`.

Re:Ask HN: Why are people in real life so different? on Monday May 16, 2022 @10:35AM (#31397967)
You can't get punched in the mouth on the internet.
Re:Why I don't like Tailwind CSS on Friday March 19, 2021 @09:04PM (#26519821)
There's `space-y-N` which does exactly this, `space-x-N` for horizontal.
Re:Why I don't like Tailwind CSS on Friday March 19, 2021 @08:58PM (#26519788)
If you want to change the padding in a project that's using Tailwind you only need to look for classes that begin with `p` followed by a letter for a side or x and y for an axis (same is true for margins). Those are by far the most cryptic classnames and by the time you finish reading this sentence you got it.

In a project where you have to name everything semantically you don't know where the hell the padding is going to be.

It's amazing for long term maintainability and quick prototyping. There is a lot of value in classes that does one thing well.

Been wrinting CSS for 15 years, switched to Tailwind 2 years ago, just for reference.

Re:Uber Wasted $2.5B on Self-Driving Cars on Monday September 28, 2020 @09:09PM (#24623157)
Yeah, but humans.
Re:In defense of functional CSS on Monday October 01, 2018 @02:33PM (#18115484)
I'm sorry I'm just not seeing the value in it. I'm just seeing more complexity JS and CSS wise without solving any problems.
Re:In defense of functional CSS on Saturday September 29, 2018 @07:26PM (#18103586)
I'm just saying if you want to target something on an element it needs to be set in an attribute and classList takes care of this.

I use classes strictly for styling. I change these styles by adding and removing class names and classList handles it very well without me needing to read the data attribute, make it an array, manipulate it, join it and update the attribute.

Re:In defense of functional CSS on Saturday September 29, 2018 @08:19AM (#18099945)
I wasn’t aware of the tilde attribute selector. Still a lot more characters, though.

The classList api is still a lot more suited for this than dataset. None of the modifications done through the dataset api would reflect in the DOM and be readable by CSS unless you were to convert the list to a space separated string and explicitly set the attribute. classList handles all of this for you.

Re:In defense of functional CSS on Thursday September 27, 2018 @09:14PM (#18090261)
Totally talking without thinking about it too much here:

The classList API makes modifications to the class property very easily.

You'd be essentially limited to one identifier in attribute selectors. You can't really select from multiple identifiers with a data attribute without doing like:

  [data-hover*="foo"]
which would search for "foo" anywhere in the attribute, which could mean incorrect substring matches.

Chaining attribute selectors would be rough too:

  [data-hover*="foo"][data-hover*="bar"] {}
vs

  .foo.bar {}
Re:In defense of functional CSS on Thursday September 27, 2018 @11:44AM (#18085572)
You're changing the source order doing this which can get messy plus generating a lot of long selectors. Example:

  .m4, .profile-card, .other-card,
  .header, .foo, blah {
    margin: 4em;
  }
Re:In defense of functional CSS on Thursday September 27, 2018 @11:00AM (#18085137)
This is how you can do all of that:

  class="hover:red" -> .hover\:red:hover { color: red }

  class="before:red" -> .before\:red::before { color: red }

  class="medium:red" -> @media (min-width: 500px) { .medium\:red { color: red }
The important thing though is it doesn't need to be used for everything. I think it makes a lot of sense for structural stuff. When you dig into like, children of a hovered element I can see it getting a little messy.
Re:In defense of functional CSS on Thursday September 27, 2018 @10:48AM (#18085013)
I'm a frontend developer of about 15 years as well and I think functional css makes a lot of sense. My biggest argument for it is not having to name every thing. You know how many times I've had to think of a name for a random container that exists simply to align some crap? Then if you need another wrapper or something for that for some reason? It eliminates the name game (whenever you want it to).
Re:In defense of functional CSS on Thursday September 27, 2018 @10:37AM (#18084909)
You can use `text-primary` or `text-secondary`. Sure it's less obvious looking at the markup what something looks like but it allows for theming.
Re:Show HN: A CSS Keylogger on Tuesday February 20, 2018 @02:37PM (#16423409)
Hopefully most are updating the property and not the attribute.
Re:Show HN: A CSS Keylogger on Tuesday February 20, 2018 @02:31PM (#16423336)
It would only give you the last character of the password though. You can use CSS selectors to check the start [value^=a] and anything in the middle [value*=a] as well though which can be revealing I imagine.
Re:Show HN: Ask a Dev on Tuesday February 06, 2018 @12:23PM (#16317720)
I love the logo. Making something as scary as a { look friendly.
Re:The web looks like shit on Thursday April 06, 2017 @09:49AM (#14050436)
Why was it hard to read for you? I'm having no trouble. I'm wondering if a lot of the CSS is more tailored towards macOS/Chrome? Also, the site being responsive makes `Command +`ing work beautifully (if the issue is font-size, but it's 18px which is larger than most sites I come across).
Re:Show HN: A guide to all HTML5 elements and attributes on Tuesday February 14, 2017 @11:46AM (#13644840)
If you like this, you'll lOoOoOoOve this: http://cssreference.io/

Older »