{"id":11585,"date":"2024-03-31T14:42:25","date_gmt":"2024-03-31T09:42:25","guid":{"rendered":"https:\/\/codehim.com\/?p=11585"},"modified":"2024-03-31T14:42:25","modified_gmt":"2024-03-31T09:42:25","slug":"toggle-button-in-css-with-stretchable-elastic-effect","status":"publish","type":"post","link":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/","title":{"rendered":"Toggle Button in CSS With Stretchable Elastic Effect"},"content":{"rendered":"<p>This code implements a toggle button in CSS with a stretchable elastic effect. The button switches between ON and OFF states. It works by using CSS animations to stretch the button&#8217;s thumb. Helpful for creating interactive UI elements.<\/p>\n<p>Moreover, you can use this code to create <a href=\"https:\/\/codehim.com\/material-design\/material-design-toggle-button-using-css\/\" target=\"_blank\" rel=\"noopener\">stylish toggle button<\/a>s on your website or web application. It adds interactivity and enhances user experience. Plus, it&#8217;s easy to implement and customize according to your design needs.<\/p>\n<h2>How to Create Toggle Button in CSS with Stretchable Elastic Effect<\/h2>\n<p>1. First, let&#8217;s set up the HTML structure. We&#8217;ll need a <code>&lt;div&gt;<\/code> element with a class of &#8220;toggle&#8221; containing an <code>&lt;input&gt;<\/code> element with a unique ID and a <code>&lt;label&gt;<\/code> element with a &#8220;for&#8221; attribute linked to the input.<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;div class=\"toggle\"&gt;\r\n\t&lt;input type=\"checkbox\" id=\"btn\"&gt;\r\n\t&lt;label for=\"btn\"&gt;\r\n\t\t&lt;span class=\"thumb\"&gt;&lt;\/span&gt;\r\n\t&lt;\/label&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>2. Next, we&#8217;ll add CSS to style our toggle button. We&#8217;ll define colors, sizes, and animations for the button and its thumb.<\/p>\n<pre class=\"prettyprint linenums lang-css\">@import url('https:\/\/fonts.googleapis.com\/css2?family=Varela+Round&amp;display=swap');\r\n\r\n:root {\r\n\t--sz: 10vmin;\r\n\t--on: #FF9800;\r\n\t--off: #243747;\r\n\t--bg: linear-gradient(135deg, #17212f, #11151e);\r\n\t--tr: all 0.5s ease 0s;\r\n\t--elastic: linear(0 0%, 0.22 2.1%, 0.86 6.5%, 1.11 8.6%, 1.3 10.7%, 1.35 11.8%, 1.37 12.9%, 1.37 13.7%, 1.36 14.5%, 1.32 16.2%, 1.03 21.8%, 0.94 24%, 0.89 25.9%, 0.88 26.85%, 0.87 27.8%, 0.87 29.25%, 0.88 30.7%, 0.91 32.4%, 0.98 36.4%, 1.01 38.3%, 1.04 40.5%, 1.05 42.7%, 1.05 44.1%, 1.04 45.7%, 1 53.3%, 0.99 55.4%, 0.98 57.5%, 0.99 60.7%, 1 68.1%, 1.01 72.2%, 1 86.7%, 1 100%);\r\n}\t\r\n\r\n* {\r\n\tbox-sizing: border-box !important;\r\n\ttransition: var(--tr);\r\n\tanimation-play-state: paused;\r\n}\r\n\r\nbody {\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\twidth: 100vw;\r\n\theight: 100vh;\r\n\toverflow: hidden;\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: center;\r\n\tbackground: var(--bg) !important;\r\n}\r\n\r\nbody:before, body:after {\r\n\tcontent: \"\";\r\n\tposition: absolute;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground: \r\n\t\trepeating-conic-gradient(#0002 0.000095%, #fff0 .0005%, #fff0 .005%, #fff0 .0005%), \r\n\t\trepeating-conic-gradient(#0002 0.00001%, #fff0 .00009%, #fff0 .00075%, #fff0 .000025%);\r\n\topacity: 0.75;\r\n\tfilter: blur(0.75px);\r\n}\r\n\r\n.toggle  {\r\n\tposition: relative;\r\n\twidth: calc(var(--sz) * 4);\r\n\theight: calc(var(--sz) * 2);\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: center;\r\n}\r\n\r\ninput {\r\n\tdisplay: none;\r\n}\r\n\r\nlabel[for=btn] {\r\n\tposition: absolute;\r\n\twidth: calc(var(--sz) * 4);\r\n\theight: calc(var(--sz) * 2);\r\n\tbackground: linear-gradient(0deg, #121720, #0d1217);\r\n\tborder-radius: var(--sz);\r\n\tbox-shadow: 0 0 calc(var(--sz) \/ 50) calc(var(--sz) \/ 50) #0006, 0 calc(var(--sz) * -0.05) calc(var(--sz) \/ 10) calc(var(--sz) \/ 500) #0b0b10, 0 0 calc(var(--sz) \/ 10) calc(var(--sz) \/ 50) #b9e1ff88, 0 calc(var(--sz) * -0.05) calc(var(--sz) \/ 5) calc(var(--sz) \/ 50) #15182fcc;\r\n}\t\r\n\r\n.thumb {\r\n\tposition: absolute;\r\n\theight: calc(calc(var(--sz) * 2) - calc(var(--sz) \/ 8));\r\n\ttop: calc(calc( var(--sz) \/ 10) + calc(var(--sz) \/ -20));\r\n\tbackground: \r\n\t\trepeating-conic-gradient(#0002 0.000095%, #fff0 .0005%, #fff0 .005%, #fff0 .0005%), \r\n\t\trepeating-conic-gradient(#0002 0.00001%, #fff0 .00009%, #fff0 .00075%, #fff0 .000025%),\r\n\t\tvar(--bg);\r\n\tborder-radius: var(--sz);\r\n\tbox-shadow: \r\n\t\t0 calc(var(--sz) * -0.05) calc(var(--sz) * 0.05) 0 #000c inset, 0 calc(var(--sz) * 0.05) calc(var(--sz) * 0.05) 0 #fff2 inset,     0 0 calc(var(--sz) \/ 10) calc(var(--sz) \/ 50) #000c,     0 calc(var(--sz) \/ 3) calc(var(--sz) \/ 3) 0 #000d;\r\n\tcursor: pointer;\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: flex-start;\r\n\tz-index: 1;\r\n\toverflow: hidden;\r\n\tpadding: calc(var(--sz)* 0.65);  \r\n\ttransition: var(--tr); \r\n\tanimation: go-left 1s ease 0s;\r\n\twidth: calc(var(--sz)* 1.875); \r\n\tright: calc(var(--sz)* 2.05); \r\n}\r\n\r\n#btn:checked + label .thumb {\r\n\ttransition: var(--tr); \r\n\tanimation: go-right 1s ease 0s;\r\n\twidth: calc(var(--sz)* 1.875); \r\n\tright: calc(var(--sz)* 0.075); \r\n\tjustify-content: flex-end;\r\n}\r\n\r\n\r\n@keyframes go-left {\r\n\t0%   { \r\n\t\twidth: calc(var(--sz)* 1.875); \r\n\t\tright: calc(var(--sz)* 0.075); \r\n\t}\r\n\t40%, 60%  { \r\n\t\twidth: calc(var(--sz)* 3.85); \r\n\t\tright: calc(var(--sz)* 0.075); \r\n\t}\r\n\t100% { \r\n\t\twidth: calc(var(--sz)* 1.875); \r\n\t\tright: calc(var(--sz)* 2.05);  \r\n\t}\r\n}\r\n\r\n\r\n@keyframes go-right {\r\n\t0%   { \r\n\t\twidth: calc(var(--sz)* 1.875); \r\n\t\tright: calc(var(--sz)* 2.05);  \r\n\t}\r\n\t40%, 60%  { \r\n\t\twidth: calc(var(--sz)* 3.85); \r\n\t\tright: calc(var(--sz)* 0.075); \r\n\t}\r\n\t100% { \r\n\t\twidth: calc(var(--sz)* 1.875); \r\n\t\tright: calc(var(--sz)* 0.075); \r\n\t}\r\n}\r\n\r\n\r\nlabel[for=btn]:before, \r\nlabel[for=btn]:after {\r\n\t--clr: var(--on);\r\n\tcontent: \"ON\";\r\n\tcolor: #fff;\r\n\tfont-family: 'Varela Round', serif;\r\n\twidth: 50%;\r\n\tfloat: left;\r\n\ttext-align: center;\r\n\tdisplay: flex;\r\n\tjustify-content: center;\r\n\theight: 100%;\r\n\tfont-size: calc(var(--sz)* 0.75);\r\n\tpadding: 0 0 0 calc(var(--sz)* 0.2);\r\n\tbox-sizing: border-box;\r\n\ttransform-origin: 100% 50%;\r\n\tanimation: muelle-on 1.5s var(--elastic) 0.5s;\r\n\tcolor: var(--clr);\r\n\ttext-shadow: 0 0 calc(var(--sz) * 0.1) var(--clr), 0 0 calc(var(--sz) * 0.3) #000, 0 0 calc(var(--sz) * 0.5) var(--clr), 0 calc(var(--sz) * 0.0125) calc(var(--sz) * 0.05) #233443, 0 calc(var(--sz) * -0.0125) calc(var(--sz) * 0.05) #000;\r\n\talign-items: center;\r\n\tline-height: calc(var(--sz) * 0.55);\r\n}\r\n\r\nlabel[for=btn]:after {\r\n\tcontent: \"OFF\";\r\n\tpadding: 0 calc(var(--sz) * 0.325) 0 0;\r\n\ttransform-origin: 0% 50%;\r\n\t--clr: var(--off);\r\n\ttext-shadow: 0 calc(var(--sz) * 0.0125) calc(var(--sz) * 0.05) #233443, 0 calc(var(--sz) * -0.0125) calc(var(--sz) * 0.05) #000;\r\n}\r\n\r\n#btn:checked + label[for=btn]:before {\r\n\tanimation-name: muelle-off; \r\n}\r\n\r\n#btn:checked + label[for=btn]:after {\r\n\tanimation: muelle-off 1.5s var(--elastic) 0.5s; \r\n}\r\n\r\n@keyframes muelle-on {\r\n\t0% { transform: scaleX(0.35); }\r\n\t100% { transform: scaleX(1); }\r\n}\r\n\r\n@keyframes muelle-off {\r\n\t0% { transform: scaleX(0.35); }\r\n\t100% { transform: scaleX(1); }\r\n}\r\n\r\n\r\n\/* light *\/\r\nspan.thumb:before {\r\n\tcontent: \"\";\r\n\tbackground: #121212;\r\n\tposition: relative;\r\n\twidth: calc(var(--sz) \/ 1.75);\r\n\theight: calc(var(--sz) \/ 1.75);\r\n\tborder-radius: var(--sz);\r\n\tbox-shadow: 0 0 calc(var(--sz) \/ 50) calc(var(--sz) \/ 50) #0008, 0 calc(var(--sz) * -0.05) calc(var(--sz) \/ 10) calc(var(--sz) \/ 500) #000, 0 calc(var(--sz) * 0.025) calc(var(--sz) \/ 10) calc(var(--sz) \/ 500) #fff8, 0 0 calc(var(--sz) \/ 20) calc(var(--sz) \/ 25) #000;\r\n}\r\n\r\nspan.thumb:after {\r\n\tcontent: \"\";\r\n\ttransition: var(--tr);transition: var(--tr);\r\n\twidth: calc(var(--sz) \/ 1.75);\r\n\theight: calc(var(--sz) \/ 1.75);\r\n\tposition: absolute;\r\n\tborder-radius: var(--sz);\r\n\t--clr: var(--off);\r\n\t--shn: #fff8;\r\n\tbox-shadow: \r\n\t\t0 0 0 calc(var(--sz) * 0.025) #000c inset, \r\n\t\t0 0 calc(var(--sz) \/ 2.5) 0 var(--clr), \r\n\t\t0 0 calc(var(--sz) \/ 3) calc(var(--sz) \/ 20) var(--clr) inset, \r\n\t\t0 calc(var(--sz) \/ -20) calc(var(--sz) \/ 10) calc(var(--sz) \/ 10) #000c inset;\r\n\tbackground: radial-gradient(circle at 50% 32%, var(--shn) 0 calc(var(--sz) \/ 20), var(--clr) calc(var(--sz) \/ 3) calc(var(--sz) \/ 3));\r\n}\r\n\r\n#btn:checked + label span.thumb:after {\r\n\t--clr: var(--on);\r\n\t--shn: #fff;\r\n}<\/pre>\n<p>Feel free to customize the CSS variables and styles to match your design preferences. You can adjust colors, sizes, and animation durations to suit your project&#8217;s theme.<\/p>\n<p>That&#8217;s all! hopefully, you have successfully created a Toggle Button with a Stretchable Elastic Effect on your website. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This code implements a toggle button in CSS with a stretchable elastic effect. The button switches between ON and OFF&#8230;<\/p>\n","protected":false},"author":1,"featured_media":11618,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[63],"tags":[],"class_list":["post-11585","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5-css3"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Toggle Button in CSS With Stretchable Elastic Effect &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a Toggle Button in CSS With Stretchable Elastic Effect. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Toggle Button in CSS With Stretchable Elastic Effect &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a Toggle Button in CSS With Stretchable Elastic Effect. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-31T09:42:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"Toggle Button in CSS With Stretchable Elastic Effect\",\"datePublished\":\"2024-03-31T09:42:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/\"},\"wordCount\":213,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png\",\"articleSection\":[\"HTML5 &amp; CSS3\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/\",\"url\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/\",\"name\":\"Toggle Button in CSS With Stretchable Elastic Effect &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png\",\"datePublished\":\"2024-03-31T09:42:25+00:00\",\"description\":\"Here is a free code snippet to create a Toggle Button in CSS With Stretchable Elastic Effect. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png\",\"width\":1280,\"height\":960,\"caption\":\"Toggle Button in CSS With Stretchable Elastic Effect\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML5 &amp; CSS3\",\"item\":\"https:\/\/codehim.com\/category\/html5-css3\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Toggle Button in CSS With Stretchable Elastic Effect\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Toggle Button in CSS With Stretchable Elastic Effect &#8212; CodeHim","description":"Here is a free code snippet to create a Toggle Button in CSS With Stretchable Elastic Effect. You can view demo and download the source code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/","og_locale":"en_US","og_type":"article","og_title":"Toggle Button in CSS With Stretchable Elastic Effect &#8212; CodeHim","og_description":"Here is a free code snippet to create a Toggle Button in CSS With Stretchable Elastic Effect. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-03-31T09:42:25+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"Toggle Button in CSS With Stretchable Elastic Effect","datePublished":"2024-03-31T09:42:25+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/"},"wordCount":213,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png","articleSection":["HTML5 &amp; CSS3"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/","url":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/","name":"Toggle Button in CSS With Stretchable Elastic Effect &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png","datePublished":"2024-03-31T09:42:25+00:00","description":"Here is a free code snippet to create a Toggle Button in CSS With Stretchable Elastic Effect. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2024\/03\/Toggle-Button-in-CSS-With-Stretchable-Elastic-Effect.png","width":1280,"height":960,"caption":"Toggle Button in CSS With Stretchable Elastic Effect"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/html5-css3\/toggle-button-in-css-with-stretchable-elastic-effect\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"HTML5 &amp; CSS3","item":"https:\/\/codehim.com\/category\/html5-css3\/"},{"@type":"ListItem","position":3,"name":"Toggle Button in CSS With Stretchable Elastic Effect"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":3334,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/11585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=11585"}],"version-history":[{"count":3,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/11585\/revisions"}],"predecessor-version":[{"id":11624,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/11585\/revisions\/11624"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/11618"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=11585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=11585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=11585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}