Top Related Projects
The HTML Presentation Framework
Modern CSS framework based on Flexbox
A utility-first CSS framework for rapid UI development.
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
A modern alternative to CSS resets
A minimalist CSS framework.
Quick Overview
You-Dont-Need-JavaScript is a GitHub repository that showcases CSS-only solutions for common web design patterns and interactions typically implemented with JavaScript. It aims to demonstrate the power and versatility of modern CSS, encouraging developers to reduce reliance on JavaScript for certain UI components and animations.
Pros
- Improves page performance by reducing JavaScript overhead
- Enhances accessibility and browser compatibility
- Encourages developers to explore and leverage advanced CSS features
- Provides a valuable learning resource for CSS techniques
Cons
- Some solutions may not be as flexible or customizable as JavaScript alternatives
- Complex interactions might still require JavaScript for optimal user experience
- Browser support for advanced CSS features may vary
- May not be suitable for all use cases or project requirements
Code Examples
- CSS-only accordion:
<div class="accordion">
<input type="checkbox" id="accordion-1" class="accordion__input">
<label for="accordion-1" class="accordion__label">Section 1</label>
<div class="accordion__content">
<p>Content for section 1</p>
</div>
</div>
<style>
.accordion__content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
}
.accordion__input:checked ~ .accordion__content {
max-height: 100vh;
}
</style>
- CSS-only modal:
<a href="#modal" class="modal-open">Open Modal</a>
<div id="modal" class="modal">
<div class="modal-content">
<h2>Modal Title</h2>
<p>Modal content goes here.</p>
<a href="#" class="modal-close">Close</a>
</div>
</div>
<style>
.modal {
opacity: 0;
visibility: hidden;
transition: opacity 0.3s, visibility 0.3s;
}
.modal:target {
opacity: 1;
visibility: visible;
}
</style>
- CSS-only tabs:
<div class="tabs">
<input type="radio" id="tab1" name="tabs" checked>
<label for="tab1">Tab 1</label>
<div class="tab-content">Content for Tab 1</div>
<input type="radio" id="tab2" name="tabs">
<label for="tab2">Tab 2</label>
<div class="tab-content">Content for Tab 2</div>
</div>
<style>
.tab-content {
display: none;
}
input[type="radio"]:checked + label + .tab-content {
display: block;
}
</style>
Getting Started
To use these CSS-only solutions in your project:
- Copy the desired HTML structure and CSS code from the examples in the repository.
- Paste the code into your HTML file or separate CSS file.
- Customize the styles and content to match your project's design.
- Test the functionality in various browsers to ensure compatibility.
Remember to consider accessibility and user experience when implementing these CSS-only solutions.
Competitor Comparisons
The HTML Presentation Framework
Pros of reveal.js
- Comprehensive framework for creating interactive presentations
- Rich set of features including themes, transitions, and plugins
- Active development and large community support
Cons of reveal.js
- Requires JavaScript for core functionality
- Steeper learning curve for advanced features
- Larger file size and potential performance overhead
Code Comparison
reveal.js (JavaScript-based):
Reveal.initialize({
controls: true,
progress: true,
center: true,
hash: true
});
You-Dont-Need-JavaScript (CSS-only):
<input type="checkbox" id="toggle" class="toggle-input">
<label for="toggle" class="toggle-label"></label>
<div class="content">
<!-- Toggle content here -->
</div>
Summary
While reveal.js offers a powerful and feature-rich solution for creating presentations, it relies heavily on JavaScript. You-Dont-Need-JavaScript, on the other hand, demonstrates CSS-only alternatives for common UI components, promoting lighter and potentially more accessible web experiences. The choice between the two depends on the specific needs of the project, with reveal.js being more suitable for complex presentations and You-Dont-Need-JavaScript serving as inspiration for minimalist, CSS-focused implementations.
Modern CSS framework based on Flexbox
Pros of Bulma
- Comprehensive CSS framework with pre-built components and layouts
- Responsive design out of the box, making it easier to create mobile-friendly websites
- Modular structure allows for customization and selective use of components
Cons of Bulma
- Requires additional HTML markup and classes, potentially increasing file size
- Less focus on pure CSS solutions, as it's a full-fledged framework
- May introduce unnecessary complexity for simple projects
Code Comparison
Bulma (using a button component):
<a class="button is-primary is-large">
<span class="icon">
<i class="fas fa-download"></i>
</span>
<span>Download</span>
</a>
You-Dont-Need-JavaScript (pure CSS dropdown):
<div class="dropdown">
<span>Dropdown</span>
<div class="dropdown-content">
<p>Hello World!</p>
</div>
</div>
Bulma provides a more structured approach with pre-defined classes, while You-Dont-Need-JavaScript focuses on minimal HTML and CSS-only solutions. The choice between them depends on project requirements, complexity, and development preferences.
A utility-first CSS framework for rapid UI development.
Pros of Tailwind CSS
- Highly customizable and flexible utility-first CSS framework
- Rapid development with pre-built classes and responsive design
- Smaller file sizes due to purging unused styles in production
Cons of Tailwind CSS
- Steeper learning curve for developers new to utility-first CSS
- Can lead to cluttered HTML with many class names
- Requires additional build step for optimal performance
Code Comparison
Tailwind CSS:
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Click me
</button>
You-Dont-Need-JavaScript:
<details>
<summary>Click me</summary>
<p>Hidden content revealed without JavaScript!</p>
</details>
Summary
Tailwind CSS offers a powerful utility-first approach to styling, enabling rapid development and customization. However, it comes with a learning curve and can lead to verbose HTML. You-Dont-Need-JavaScript focuses on leveraging native HTML and CSS features to reduce reliance on JavaScript, promoting simpler and more accessible solutions for common UI patterns. The choice between these approaches depends on project requirements, team expertise, and performance considerations.
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
Pros of Bootstrap
- Comprehensive framework with pre-built components and responsive grid system
- Extensive documentation and large community support
- Cross-browser compatibility and mobile-first approach
Cons of Bootstrap
- Larger file size and potential performance impact
- Less flexibility for unique designs without heavy customization
- Steeper learning curve for beginners
Code Comparison
Bootstrap (CSS):
<div class="container">
<div class="row">
<div class="col-md-4">Column 1</div>
<div class="col-md-4">Column 2</div>
<div class="col-md-4">Column 3</div>
</div>
</div>
You-Dont-Need-JavaScript (HTML/CSS):
<details>
<summary>Expandable Section</summary>
<p>Hidden content revealed without JavaScript.</p>
</details>
Bootstrap provides a robust grid system and pre-built components, making it easier to create responsive layouts quickly. However, it comes with a larger file size and may require more effort to customize.
You-Dont-Need-JavaScript focuses on achieving common UI patterns using only HTML and CSS, resulting in lighter and potentially faster-loading pages. It's ideal for simple projects or when minimizing JavaScript usage is a priority, but may lack the comprehensive features and extensive documentation of Bootstrap.
A modern alternative to CSS resets
Pros of normalize.css
- Focused on CSS normalization and browser consistency
- Lightweight and easy to integrate into any project
- Well-maintained and widely adopted in the web development community
Cons of normalize.css
- Limited in scope, only addresses CSS normalization
- Doesn't provide guidance on reducing JavaScript usage
- May require additional CSS for more complex styling needs
Code Comparison
normalize.css:
html {
line-height: 1.15;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
You-Dont-Need-JavaScript:
<details>
<summary>Expand/Collapse</summary>
<p>Hidden content</p>
</details>
Summary
normalize.css and You-Dont-Need-JavaScript serve different purposes in web development. normalize.css focuses on providing a consistent CSS baseline across browsers, while You-Dont-Need-JavaScript demonstrates CSS-only solutions for common UI patterns typically implemented with JavaScript.
normalize.css is ideal for projects requiring a solid CSS foundation, whereas You-Dont-Need-JavaScript is more suitable for developers looking to reduce JavaScript usage and leverage CSS for interactive elements.
Both repositories contribute valuable resources to the web development community, but they address different aspects of front-end development. Developers may find it beneficial to use both in conjunction, depending on their project requirements and performance goals.
A minimalist CSS framework.
Pros of Milligram
- Provides a complete CSS framework with a minimalist approach
- Offers a responsive grid system and pre-styled components
- Easier to implement for full website styling
Cons of Milligram
- Requires including external CSS files, increasing page load time
- Less focused on pure CSS solutions for interactive elements
- May introduce unnecessary styles for simple projects
Code Comparison
Milligram (CSS for a button):
.button,
button,
input[type='button'],
input[type='reset'],
input[type='submit'] {
background-color: #9b4dca;
border: 0.1rem solid #9b4dca;
border-radius: .4rem;
color: #fff;
cursor: pointer;
display: inline-block;
font-size: 1.1rem;
font-weight: 700;
height: 3.8rem;
letter-spacing: .1rem;
line-height: 3.8rem;
padding: 0 3.0rem;
text-align: center;
text-decoration: none;
text-transform: uppercase;
white-space: nowrap;
}
You-Dont-Need-JavaScript (CSS for a dropdown menu):
.dropdown:focus-within .dropdown-menu {
opacity: 1;
transform: translate(0) scale(1);
visibility: visible;
}
Milligram provides a complete styling solution, while You-Dont-Need-JavaScript focuses on CSS-only interactive elements. The choice depends on project requirements and complexity.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
English | ç®ä½ä¸æ
You Don't Need JavaScript
Please be aware that the demos may exhibit significant accessibility issues, such as problems with keyboard navigation, speech synthesis, and progressive enhancement or degradation.
Style Guide:
## <a id="DemoSubject"></a>Carousel
[<img src="images/image1.png" height="230" title="Demo 1">](http://url-to-page)
[<img src="images/image2.png" height="230" title="Demo 2">](http://url-to-page)
[<img src="images/image3.png" height="230" title="Demo 3">](http://url-to-page)
**[⬠back to top](#quick-links)**
Quick links
- You Don't Need JavaScript
- Style Guide:
- Quick links
- Accordion / Toggle
- Analog-clock
- Animated Button
- Animated Buttons
- Bonfire
- Bubble
- Burger Menu
- Button Animation
- Captain America Shield
- Carousel
- Compass Loader
- City animation footer
- Counter of checked check-boxes
- Dog Box Animation
- Dropdown Menu
- Dynamic Image Colorizing
- Enable dark mode
- Fancy Menu
- Flip on click
- Floating label on Textfield
- Floating Labels V2
- Font-Face (Latin)
- Footer
- Gradient Animation
- growing-flower
- growing-flower
- Image Gallery
- infinite-carousel
- Info on hover/ Popover
- Jumping Ball
- Light Bulb Animation
- Loaders
- Mobile menu off canvas
- Modal/Popup
- Mouse tracking
- NavBar
- Neon Button
- Neon Card
- Neumorphism Card Design
- Parallax scrolling
- Pendulum
- Playing Card Animation
- Responsive Counter Showing # of Items That Didn't Fit Screen
- Ripple Effect
- Scary animation
- Scenary
- Shake Button
- Shake Button
- Shuffling squares
- Star Wars Intro
- Switch
- Tabs
- Thankyou-Animation
- Todo List
- Tooltips
- Treeview
- Twitter Heart Animation
- Book Animation
- Zoom when hover
- Contributors
- Contributing
- CSS Toggle
- Sliced Button
- DVD Screen Saver
- RotateSquare
CSS Toggle
Accordion / Toggle
Animated Buttons
Captain America Shield
Carousel
Counter of checked check-boxes
Flip on click
Flip on click
Flip on click
Animated Box
Analog-clock
Font-Face (Latin)
Info on hover/ Popover
Image Gallery
Loaders
Dropdown Menu
Mobile menu off canvas
Burger Menu
Button Animation
Compass Loader
Fancy Menu
Footer
Modal/Popup
Mouse tracking
NavBar
Parallax scrolling
Tabs
Todo List
Tooltips
Treeview
Twitter Heart Animation
Book Animation
Dynamic Image Colorizing
DarkMode
Ripple Effect
Responsive Counter Showing # of Items That Didn't Fit Screen
A login Page with Glassmorphism Effect
[]
Neumorphism Card Design
Neon Button
Neon Card
Shake Button
Shake Button
Dog Box Animation
Thankyou-Animation
Square_rotation_animation (Latin)
Switch
Bonfire
Scenary
Bubble
Flower
Jumping Ball
Light Bulb Animation
City animation footer
Smoke
Loader
Spiner
Fire
Flame
Shuffling squares
Floating-labelV2
scary-animation
infinite-carousel
=======
=======
growing-flower
Playing Card Animation
Star Wars Intro
Gradient Animation
Zoom when hover
Floating-labelV2
CSS Tables
=======
3D Transform
Animated Button
Css FLEX
Coffee-Animation
=======
Basketball-Animation
=======
Business-Card
=======
SolarSystem
⬠back to top
Pendulum
⬠back to top
SlicedButton
⬠back to top
Rating Star
⬠back to top
DVD Screen Saver
⬠back to top
RotateSquare
[]
=======
---
## Contributors
Thanks to these wonderful people who have contributed to this project!
<a href="https://github.com/you-dont-need/You-Dont-Need-JavaScript/graphs/contributors">
<img src="https://contrib.rocks/image?repo=you-dont-need/You-Dont-Need-JavaScript" />
</a>
## Contributing
We welcome contributions from the community to make this project better. Feel free to fork the repository, make your changes, and submit a pull request. Be sure to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
For detailed guidelines on how to contribute, please refer to our [CONTRIBUTING](CONTRIBUTING.md) file.
Let's build something great together!
Top Related Projects
The HTML Presentation Framework
Modern CSS framework based on Flexbox
A utility-first CSS framework for rapid UI development.
The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
A modern alternative to CSS resets
A minimalist CSS framework.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot