16+ CSS Open Close Buttons

An open-close button in CSS generally refers to a button used in web interfaces to toggle the visibility of a menu, panel, dialog, or other content. These buttons are commonly seen in responsive designs, especially for navigation menus in mobile views (often represented as a “hamburger” icon which transforms into a “‘X‘” icon).

In this post, I have shared a collection of 16+ CSS open close buttons, complete with their source code. This compilation showcases a variety of close animations and effects, offering diverse styles from simple toggles to intricate animations. Each button is uniquely designed to enhance user interaction, providing both functionality and aesthetic appeal to your web projects.

Open & Close Button CSS

Open & Close Button CSS

Travis Hedrick

HTML & CSS

Yes

Description

This Open Close Button example showcases a button with an interactive hover effect. Styled primarily with CSS, the button changes color, border, and undergoes a transformation upon hovering. The key CSS properties include transition: all 0.3s ease-out, which smooths the transition effects, and transform: scale(0.8) rotateZ(90deg) on hover, scaling down the button and rotating it.

Cross Close Button

Cross Close Button

Paraskevas Dinakis

HTML & CSS

Yes

Description

This Cross Close Button example features a button designed to look like a cross, typically used for closing interfaces. The button is created using CSS, specifically through the .inner:before and .inner:after pseudo-elements. These elements are styled with a height, width, and background color, and positioned absolutely within a parent div. They are initially rotated at 45 and -45 degrees to form a cross. On hover, the :hover pseudo-class alters their rotation to 0 degrees and moves them vertically, creating a dynamic effect.

Menu Close Button Animation

Menu Close Button Animation

Pentagear

HTML & CSS

Yes

Description

This example is to create a button with an interactive animation effect, showcasing how CSS and JavaScript can work together for dynamic UI elements.

  1. CSS for Button Spans: The spans inside the button are styled with properties like width, height, and background-color. They are positioned using position: absolute and rotated using transform: rotate(45deg) or similar values to create a cross shape.
  2. JavaScript Click Event: A jQuery click event handler is attached to the button. This handler toggles a class on the button, which likely triggers the CSS transformations.
  3. CSS Transformations on Toggle: The toggled class modifies the CSS transform property of the spans, changing their rotation and position, thus altering the button’s appearance dynamically on click.

Open & Close Button With Animation

Open & Close Button With Animation

Murphy Randle

HAML, SCSS & Js

Yes

Close Animation

Close Animation

Maneesh

HAML, SCSS & Js

Yes

Smooth Hamburger Close Button

Smooth Hamburger Close Button

Trevor Phillippi

Pug, SCSS & Js

Yes

Close Button

Close Button

Jermbo

Html & Less

Yes

CSS Animated Open and Close Button


Jerome Renders

Pug, SASS & Js

Yes

Html Close Button

Html Close Button

merrybottle

Html & CSS

Yes

Simple Pure CSS Close Button

Simple Pure CSS Close Button

Marvin van Kalsbeek

Html & CSS

Yes

Hamburger Menu Button to Close Button

Hamburger Menu Button to Close Button

Markmiscavage

Html, CSS & Js

Yes

Hamburger to Close Button

Hamburger to Close Button

Gaurav Patil

Html, CSS & Js

Yes

Open and Close Button With Animation

Open and Close Button With aAnimation

Martin Wolf

Html, CSS & Js

Yes

Interactive Animated Close Button

Interactive Close Button Animation

Marius Nicula

Html & CSS

Yes

Close Button CSS Animation

Close Button CSS Animation

Bert-Ulrich Baumann

Html, CSS & Js

Yes

Different Close Button Effects

Different Close Button Effects

Jonas Badalic

Html, CSS & Js

Yes

Different Flipping Style Close Buttons

Different Flipping Style Close Buttons

Mikael Ainalem

Html & CSS

Yes

Animated Close Button CSS

Animated Close Button CSS

Ellorex

Html & CSS

Yes

Leave a Comment