Live data from Hacker News

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

github.com

1–10 of 319 posts

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

#2
The problem with using css this way is that it's not as obvious what's supposed to happen as it is when using js. I'd love for there to be some explanation within the examples of _why_ they work - I've just been reading the first modal example but I can't really understand it

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

#3

The problem with using css this way is that it's not as obvious what's supposed to happen as it is when using js. I'd love for there to be some explanation within the examples of _why_ they work - I've just been reading the first modal example but I can't really understand it

The :target pseudoclass is used, along with anchors. It means that it also pollutes the browser history, which is somewhat appropriate for modals, but probably not what you want.

Still neat though.

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

#7

The problem with using css this way is that it's not as obvious what's supposed to happen as it is when using js. I'd love for there to be some explanation within the examples of _why_ they work - I've just been reading the first modal example but I can't really understand it

The :target pseudoclass is used, along with anchors. It means that it also pollutes the browser history, which is somewhat appropriate for modals, but probably not what you want. Still neat though.

How does the browser know which modal is targetted though? I thought :target had to match the hash, but both links just link to # :S

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

#8

Earlier quoted context omitted.

The :target pseudoclass is used, along with anchors. It means that it also pollutes the browser history, which is somewhat appropriate for modals, but probably not what you want. Still neat though.

How does the browser know which modal is targetted though? I thought :target had to match the hash, but both links just link to # :S

Ah forget that, as usual it's immediately obvious after I post that I don't understand! Looks like I had a bit of a mental block and couldn't see the top buttons for some reason - I was looking at the close links.

Yup that all makes sense now then

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

#10
Although I think this is an interesting exercise, I need these behaviours to work the same across all browsers. This gets even more complicated within JavaScript apps where the state of the components is something I need to have fine grained control over.

Really cool and good to see what how powerful CSS3 is, but not sure how useful it is, particularly when I need this behaviour working on older mobile browsers.

Post reply on HN