TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to write a JavaScript-free todo app using just HTML and CSS

149 pointsby mostlystaticover 7 years ago

14 comments

Scryptoniteover 7 years ago
I made something very similar for fun a few years ago[0] and added it to a repository called You-Dont-Need-JavaScript[1].<p>CSS-only for this sort if thing is totally contrived, but making it still proved to be a fun little exercise.<p>[0]: <a href="https:&#x2F;&#x2F;codepen.io&#x2F;scryptonite&#x2F;pen&#x2F;oLGzdj" rel="nofollow">https:&#x2F;&#x2F;codepen.io&#x2F;scryptonite&#x2F;pen&#x2F;oLGzdj</a><p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;you-dont-need&#x2F;You-Dont-Need-JavaScript" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;you-dont-need&#x2F;You-Dont-Need-JavaScript</a>
ape4over 7 years ago
So you can but... looking at the code... you don&#x27;t want to.
评论 #15587844 未加载
jordacheover 7 years ago
These exercises will be a lot more fruitful to read through if the author can acknowledge the contrived nature of these attempts and provide a real-world advantageous use case of the techniques outlined
评论 #15588707 未加载
评论 #15589128 未加载
评论 #15590839 未加载
billnreedover 7 years ago
That&#x27;s super cool! The `:checked` and `:valid` and `:invalid` selectors are really powerful tools when it comes to CSS. This is a real fun use of clever CSS selectors.<p>I was doing something similar the other day with toying around trying to come up with an HTML&#x2F;CSS only game. I ended up with this: <a href="https:&#x2F;&#x2F;codepen.io&#x2F;billnreed&#x2F;full&#x2F;boXrVr" rel="nofollow">https:&#x2F;&#x2F;codepen.io&#x2F;billnreed&#x2F;full&#x2F;boXrVr</a>
mkhalilover 7 years ago
In doing this, you break HTML semantic relationships. Each to-do is a child of the previous to-do. That hurts.<p>I applaud the work in making something sans JS for the kicks of it, but if your going to do it, at least don&#x27;t break HTML.
评论 #15588801 未加载
cowmoo728over 7 years ago
These kinds of tricks are nice for progressive enhancement - you can have a navigation section in your server-side-rendered SPA that outputs a fully usable nav like this, and if a user has JS disabled, they&#x27;ll still be able to navigate around your site, albeit with hard page reloads instead of more instant transitions. It&#x27;s funny that people are using js frameworks to render js-free snippets that are then progressively enhanced with more js, but that&#x27;s web development today.
评论 #15587710 未加载
frandroidover 7 years ago
&gt; What doesn’t work: &gt; Persistence after page reload<p>That&#x27;s not an app.<p>TL;DR: Use styled checkboxes in a form.
评论 #15589564 未加载
评论 #15590204 未加载
评论 #15590858 未加载
bachmeierover 7 years ago
I know a lot of people hate JavaScript, but is HTML+CSS really a more pleasant programming approach? The &quot;solution&quot; seems worse than the problem.
评论 #15589770 未加载
评论 #15589736 未加载
supermdguyover 7 years ago
Now we just need someone to write a frontend framework that compiles down to CSS.
idbeholdover 7 years ago
So what happens when I create my 51st todo?
评论 #15587965 未加载
评论 #15587971 未加载
sAbakumoffover 7 years ago
I look forward to a day when it will be doable to mine bitcoins by using CSS!
chaitanyanaover 7 years ago
I made something just like this for my introduction class in computer science
snambiover 7 years ago
this is really nice. need a break from javascript.
评论 #15588037 未加载
评论 #15588557 未加载
gmanolacheover 7 years ago
Is this a joke?
评论 #15590610 未加载