Live data from Hacker News

CSS is powerful, you can do a lot of things without JS

github.com

211–220 of 319 posts

Re: CSS is powerful, you can do a lot of things without JS

#211
post #103

And here I am, trying for past 10 years to centre align a div, both horizontally and vertically.

You took the words right out of my mouth(fingers). Was just thinking the exact same thing

How about learning some CSS? This "joke" should really be retired by now. I've been doing this stuff 10+ years ago when stills supporting IE5, for fucks sake.

Re: CSS is powerful, you can do a lot of things without JS

#212
post #194

Earlier quoted context omitted.

With jQuery it's probably like 4 or 5 lines. With plain JS a few more as you have to write your own iterator function. All an accordion does is add an event listener that removes a class from all elements and adds it back to one of them. Then there's a 1 line transition for that class in css.

Is jQuery included in those 4 or 5 lines? One line of CSS in your accordion?

If you had read the next sentence of my comments you would have seen that it would be a "few more lines" if you didn't use jQuery, basically you need a function like:

  function eachItem(arrayLike, cb) {
    return [].slice.call(arrayLike).forEach(cb);
  }
So 3 more lines. If I said you can write a very verbose accordion in under 20 lines would that be good enough for you?

Re: CSS is powerful, you can do a lot of things without JS

#213

Earlier quoted context omitted.

My current-favorite problem with modern web development is mobile-specific redirection. e.g. you click a link in your email and it takes you to "www.foo.com/somethingWithParametersAndImportantStuff", foo.com detects you're on a phone and redirects you to their mobile homepage at "m.foo.com", blowing away your URL or even better not supporting your particular URL's page in the mobile site... where... your mobile brows…

http://xkcd.com/869/ Anyone know where I can find publication dates for individual comics? I don't see anything on the comic's page.

For questions like that I tend to jump over to the Explain XKCD wiki.

This comic was March 7, 2011.

http://www.explainxkcd.com/wiki/index.php/869:_Server_Attent...

Re: CSS is powerful, you can do a lot of things without JS

#215
post #122

I've worked with people who did things like this. It's not fun for anyone else on the team to try and figure out why you're using specific pseudo selectors on tags in a child inside a sibling in some label to make an accordion that would take 3 lines in Javascript.

I'm interested in seeing these 3 lines of Javascript that can implement an accordion. With a sane limit to number of characters on each line as well.

If one is already using jQuery - https://jsfiddle.net/jw75xznb/

Yeah, it's incredibly crude but it is 3 lines and it took approximately 60 seconds.

Re: CSS is powerful, you can do a lot of things without JS

#216

Earlier quoted context omitted.

I'm very curious about this: is there a hypothesis that non-mobile computers are going away in the business world and/or that "young people" will not be involved in that world? I don't know the stats - are tablets making big inroads in business computing?

Dunno. But my niece and nephew are tablet/phone experts, and have never used a mouse. And they are 4 and 6.

If it comforts you, I used an upside-down SNES gamepad for a few years before ever touching a mouse. And today I use my mouse far more than any game controllers.

Re: CSS is powerful, you can do a lot of things without JS

#217

Earlier quoted context omitted.

Digression: 'clicking on a link' may become an obscure reference soon, like dialing a phone. How many young people ever use a mouse?

I'm very curious about this: is there a hypothesis that non-mobile computers are going away in the business world and/or that "young people" will not be involved in that world? I don't know the stats - are tablets making big inroads in business computing?

Humans have several millennia of evolution "touching things" for tactile feedback. Mice on the other hand are a relative (and quite useful) hack compared to that. It requires training and a different mental dimensional model to use. To a child growing up with modern touch screens, a screen without touch is the aberration and "broken". Mice may not disappear entirely, but certainly more and more screens in our lives will support touch interactions, even on desktops and "non-mobile computers", simply because it requires less training and feels more natural ("touch the button" versus "move the mouse to the button and click" may not seem that different after decades of mouse usage, but are very different experiences to an untrained person). There's a sense already today that kids growing up with tablets find mice strange and annoying ("Why can't I just touch that?"), and it's easy to wonder watching today's kids if mice will last for more than a footnote in history and in increasingly small niches that require "headshot precision" like games and maybe CAD.

Re: CSS is powerful, you can do a lot of things without JS

#218

Earlier quoted context omitted.

> Browsers/webapps have only become this crazily successful because they allow seamless delivery of applications to run locally. I'm going to heavily disagree with you. There were plenty of sites that were successful without using heavy JS. Most webapps I see can run easily without JS, they just choose not to. Yes, there are exceptions, but they are exceptions. "The core features people want" aren't JS-pop-ups, and s…

> They want sites that work quickly, are easy to understand, and work on mobile just as well as on a desktop. Not quite: users want to achieve specific tasks as quickly and easily as possible. Certainly "work quickly" and "work on mobile" are two huge pillars of that for many (probably the majority of) tasks, but for many applications you have to make significant trade-offs in functionality under the constraints of a…

And it's not clear to me that fixing a broken system is worth the time, when we have a working system standing by idly. I don't know of anyone who is asking for more interactiveness for most of the web, but I do know that non-js works, and works well. It may not be as "interactive", but I view that as a good thing.

Of course, this is all in context of a typical webpage. There are exceptions to this.

Re: CSS is powerful, you can do a lot of things without JS

#219

Earlier quoted context omitted.

"best viewed in Chrome" is getting annoyingly common.

Bank Of America recently told me it only supported Safari and Chrome on MacOS... But... supported Firefox on Windows. Whaaaa....

I called my bank because I couldn't log in

"We recommend Internet Explorer."

Re: CSS is powerful, you can do a lot of things without JS

#220
post #92
post #81

Earlier quoted context omitted.

Hmmm... .accordion .content { padding:0 10px; overflow:hidden; border:1px solid #fff; -webkit-transition: all .5s ease-out; -moz-transition: all .5s ease-out; } -webkit-transition, -moz-transition... it's like we're at 180 degrees to where the web was in the days of IE4-6

Remember when Good Developers would hate on framesets because they break the back button and linking and everything? Now it's totally OK to break all that with AJAX and "text-as-apps"... I much prefer the days of the old web.

That's a very outdated view on webapps.

https://developer.mozilla.org/en-US/docs/Web/API/History_API...

Post reply on HN