Convert Figma logo to code with AI

you-dont-need logoYou-Dont-Need-JavaScript

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

19,006
1,193
19,006
43

Top Related Projects

67,545

The HTML Presentation Framework

49,128

Modern CSS framework based on Flexbox

A utility-first CSS framework for rapid UI development.

169,947

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

A modern alternative to CSS resets

10,193

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

  1. 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>
  1. 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>
  1. 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:

  1. Copy the desired HTML structure and CSS code from the examples in the repository.
  2. Paste the code into your HTML file or separate CSS file.
  3. Customize the styles and content to match your project's design.
  4. Test the functionality in various browsers to ensure compatibility.

Remember to consider accessibility and user experience when implementing these CSS-only solutions.

Competitor Comparisons

67,545

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.

49,128

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.

169,947

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.

10,193

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 Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

English | 简体中文

You Don't Need JavaScript

Join the community on Spectrum

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

CSS Toggle

Toggle Toggle

⬆ back to top

Accordion / Toggle

⬆ back to top


 

Animated Buttons

⬆ back to top



 

Captain America Shield

⬆ back to top


 

Carousel

Carousel-Nepal

⬆ back to top


 

Counter of checked check-boxes

⬆ back to top


 

Flip on click

⬆ back to top


 

Flip on click

⬆ back to top


 

Flip on click

⬆ back to top


 

Animated Box

⬆ back to top

Analog-clock

⬆ back to top


 

⬆ back to top


 

Font-Face (Latin)

⬆ back to top


 

Info on hover/ Popover

⬆ back to top


 

Image Gallery

⬆ back to top


 

Loaders

CSS-Loader-Purna

⬆ back to top


 

Dropdown Menu

⬆ back to top


 

Mobile menu off canvas

⬆ back to top


 

Burger Menu

⬆ back to top


 

Button Animation

⬆ back to top


 

Compass Loader

⬆ back to top


 

Fancy Menu

⬆ back to top


 

Footer

⬆ back to top


 

Modal/Popup

⬆ back to top


 

Mouse tracking

⬆ back to top


 


NavBar

⬆ back to top


 

Parallax scrolling

⬆ back to top


 

Tabs

⬆ back to top


 

Todo List

⬆ back to top


 

Tooltips

Treeview

⬆ back to top


 

Twitter Heart Animation

⬆ back to top


 

Book Animation

⬆ back to top


 

Dynamic Image Colorizing

⬆ back to top


 

DarkMode

⬆ back to top

 

Ripple Effect

⬆ back to top


 

Responsive Counter Showing # of Items That Didn't Fit Screen

⬆ back to top


 

A login Page with Glassmorphism Effect

[]

⬆ back to top


 

 

Neumorphism Card Design

⬆ back to top


 

Neon Button

⬆ back to top


 

Neon Card

⬆ back to top


 

Shake Button

⬆ back to top

Shake Button

⬆ back to top


 

Dog Box Animation

⬆ back to top


 

Thankyou-Animation

⬆ back to top


 

Square_rotation_animation (Latin)

⬆ back to top


 

Switch

⬆ back to top


 

Bonfire

⬆ back to top


 

Scenary

⬆ back to top


 

Bubble

⬆ back to top


 

Flower

⬆ back to top


 

Jumping Ball

⬆ back to top


 

Light Bulb Animation

⬆ back to top


 

City animation footer

⬆ back to top


 

Smoke

⬆ back to top


 

Loader

⬆ back to top


 

Spiner

⬆ back to top


 

Fire

⬆ back to top


 

Flame

⬆ back to top


Shuffling squares


Floating-labelV2

⬆ back to top


scary-animation

⬆ back to top


infinite-carousel

=======

=======

⬆ back to top


growing-flower

⬆ back to top


 

Playing Card Animation

⬆ back to top


Star Wars Intro

⬆ back to top

Gradient Animation

⬆ back to top

Zoom when hover


Floating-labelV2

⬆ back to top


CSS Tables

Screenshot 2023-10-23 144658

=======

3D Transform

animation

Animated Button

⬆ back to top


Css FLEX

Screenshot 2023-10-23 141538

 

Coffee-Animation

⬆ back to top

=======  

Basketball-Animation

⬆ back to top

=======  

Business-Card

img_source

⬆ back to top

=======  

SolarSystem

img_source

⬆ back to top

 

Pendulum

img_source

⬆ back to top

 

SlicedButton

img_source

⬆ back to top

 

Rating Star

img_source

⬆ back to top

 

DVD Screen Saver

img_source

⬆ back to top

 

RotateSquare

[]

⬆ back to top

=======
&nbsp;

---

## 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!