{"id":1821,"date":"2016-09-15T16:37:33","date_gmt":"2016-09-15T16:37:33","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=1821"},"modified":"2016-09-15T16:37:33","modified_gmt":"2016-09-15T16:37:33","slug":"create-toggle-switch-using-css","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/","title":{"rendered":"How to Create a Toggle Switch using CSS"},"content":{"rendered":"<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-1024x576.png\" alt=\"how-to-create-toggle-switch-using-css-codexworld\" width=\"960\" height=\"540\" class=\"alignnone size-large wp-image-1822\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-1024x576.png 1024w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-300x169.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-768x432.png 768w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-350x197.png 350w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-320x180.png 320w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-380x214.png 380w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-200x112.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld-346x195.png 346w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png 1366w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/div>\n<p>This tutorial will show you how to create a toggle switch button with CSS. In your project where you&#8217;ve placed checkbox for the filtering purpose, replace the checkbox with a toggle switch. The toggle switch will add a neat and clean user experience to checkbox functionality. The toggle switch can be created using pure CSS, so you can use toggle switch as a filtering button in your web project. If you want to provide a better user experience on the web project, then display a toggle switch instead of a checkbox.<\/p>\n<p>Here we&#8217;ll provide the short CSS code snippets for normal and rounded toggle switch. Use a normal style or round style toggle switch based on your web page layout.<\/p>\n<h2>HTML<\/h2>\n<p>Add the following HTML where you want to display a toggle switch checkbox.<\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">label<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"switchBtn\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"checkbox\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"slide\"<\/span>>Filter On&lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n&lt;\/<span style=\"color:#bf4f24\">label<\/span>>\r\n<\/pre>\n<p><b>Rounded Style Toggle Switch<\/b><\/p>\n<pre>&lt;<span style=\"color:#bf4f24\">label<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"switchBtn\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"checkbox\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"slide round\"<\/span>>Filter On&lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n&lt;\/<span style=\"color:#bf4f24\">label<\/span>>\r\n<\/pre>\n<h2>CSS<\/h2>\n<p>Add the following CSS to change checkbox to toggle switch button.<\/p>\n<pre><span style=\"color:#bf4f24\">.switchBtn<\/span> {\r\n    <span style=\"color:#691c97\">position<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">relative<\/span>;\r\n    <span style=\"color:#691c97\">display<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">inline-block<\/span>;\r\n    <span style=\"color:#691c97\">width<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">110<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">height<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">34<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.switchBtn<\/span> <span style=\"color:#bf4f24\">input<\/span> {<span style=\"color:#691c97\">display<\/span><span style=\"color:#794938\">:<\/span><span style=\"color:#b4371f\">none<\/span>;}\r\n<span style=\"color:#bf4f24\">.slide<\/span> {\r\n    <span style=\"color:#691c97\">position<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">absolute<\/span>;\r\n    <span style=\"color:#691c97\">cursor<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">pointer<\/span>;\r\n    <span style=\"color:#691c97\">top<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n    <span style=\"color:#691c97\">left<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n    <span style=\"color:#691c97\">right<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n    <span style=\"color:#691c97\">bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n    <span style=\"color:#691c97\">background-color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#ccc<\/span>;\r\n    -webkit-transition<span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">.4<span style=\"color:#794938\">s<\/span><\/span>;\r\n    transition<span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">.4<span style=\"color:#794938\">s<\/span><\/span>;\r\n    <span style=\"color:#691c97\">padding<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">8<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#fff<\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.slide<\/span><span style=\"color:#bf4f24\">:before<\/span> {\r\n    <span style=\"color:#691c97\">position<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">absolute<\/span>;\r\n    <span style=\"color:#691c97\">content<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#0b6125\">\"\"<\/span>;\r\n    <span style=\"color:#691c97\">height<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">26<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">width<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">26<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">left<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">78<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">4<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">background-color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">white<\/span>;\r\n    -webkit-transition<span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">.4<span style=\"color:#794938\">s<\/span><\/span>;\r\n    transition<span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">.4<span style=\"color:#794938\">s<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">input<\/span><span style=\"color:#bf4f24\">:checked<\/span> + <span style=\"color:#bf4f24\">.slide<\/span> {\r\n    <span style=\"color:#691c97\">background-color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#8CE196<\/span>;\r\n    <span style=\"color:#691c97\">padding-left<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">40<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">input<\/span><span style=\"color:#bf4f24\">:focus<\/span> + <span style=\"color:#bf4f24\">.slide<\/span> {\r\n    <span style=\"color:#691c97\">box-shadow<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span> <span style=\"color:#811f24;font-weight:700\">1<span style=\"color:#794938\">px<\/span><\/span> <span style=\"color:#811f24;font-weight:700\">#01aeed<\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">input<\/span><span style=\"color:#bf4f24\">:checked<\/span> + <span style=\"color:#bf4f24\">.slide<\/span><span style=\"color:#bf4f24\">:before<\/span> {\r\n    -webkit-transform<span style=\"color:#794938\">:<\/span> translateX(<span style=\"color:#811f24;font-weight:700\">26<span style=\"color:#794938\">px<\/span><\/span>);\r\n    -ms-transform<span style=\"color:#794938\">:<\/span> translateX(<span style=\"color:#811f24;font-weight:700\">26<span style=\"color:#794938\">px<\/span><\/span>);\r\n    transform<span style=\"color:#794938\">:<\/span> translateX(<span style=\"color:#811f24;font-weight:700\">26<span style=\"color:#794938\">px<\/span><\/span>);\r\n    <span style=\"color:#691c97\">left<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">-20<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<\/pre>\n<p><b>Rounded Style Toggle Switch<\/b><br \/>\nAdd the following CSS with the above CSS for making toggle button rounded.<\/p>\n<pre><span style=\"color:#bf4f24\">.slide<\/span><span style=\"color:#bf4f24\">.round<\/span> {\r\n    <span style=\"color:#691c97\">border-radius<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">34<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.slide<\/span><span style=\"color:#bf4f24\">.round<\/span><span style=\"color:#bf4f24\">:before<\/span> {\r\n    <span style=\"color:#691c97\">border-radius<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">50<span style=\"color:#794938\">%<\/span><\/span>;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will show you how to create a toggle switch button with CSS. In your project where you&#8217;ve placed checkbox for the filtering purpose, replace the checkbox with a toggle switch. The toggle switch <\/p>\n","protected":false},"author":1,"featured_media":1822,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[124],"class_list":["post-1821","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css","tag-css","cat-9-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create a Toggle Switch using CSS - CodexWorld<\/title>\n<meta name=\"description\" content=\"Toggle Switch with CSS - A simple code snippet to create a toggle switch using CSS. Change checkbox to toggle switch using pure CSS.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a Toggle Switch using CSS - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Toggle Switch with CSS - A simple code snippet to create a toggle switch using CSS. Change checkbox to toggle switch using pure CSS.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-15T16:37:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"How to Create a Toggle Switch using CSS\",\"datePublished\":\"2016-09-15T16:37:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/\"},\"wordCount\":177,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/how-to-create-toggle-switch-using-css-codexworld.png\",\"keywords\":[\"CSS\"],\"articleSection\":[\"CSS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/\",\"name\":\"How to Create a Toggle Switch using CSS - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/how-to-create-toggle-switch-using-css-codexworld.png\",\"datePublished\":\"2016-09-15T16:37:33+00:00\",\"description\":\"Toggle Switch with CSS - A simple code snippet to create a toggle switch using CSS. Change checkbox to toggle switch using pure CSS.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/how-to-create-toggle-switch-using-css-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/how-to-create-toggle-switch-using-css-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"how-to-create-toggle-switch-using-css-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-toggle-switch-using-css\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a Toggle Switch using CSS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create a Toggle Switch using CSS - CodexWorld","description":"Toggle Switch with CSS - A simple code snippet to create a toggle switch using CSS. Change checkbox to toggle switch using pure CSS.","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:\/\/www.codexworld.com\/create-toggle-switch-using-css\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a Toggle Switch using CSS - CodexWorld","og_description":"Toggle Switch with CSS - A simple code snippet to create a toggle switch using CSS. Change checkbox to toggle switch using pure CSS.","og_url":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2016-09-15T16:37:33+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"How to Create a Toggle Switch using CSS","datePublished":"2016-09-15T16:37:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/"},"wordCount":177,"commentCount":1,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png","keywords":["CSS"],"articleSection":["CSS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/","url":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/","name":"How to Create a Toggle Switch using CSS - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png","datePublished":"2016-09-15T16:37:33+00:00","description":"Toggle Switch with CSS - A simple code snippet to create a toggle switch using CSS. Change checkbox to toggle switch using pure CSS.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png","width":1366,"height":768,"caption":"how-to-create-toggle-switch-using-css-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/create-toggle-switch-using-css\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"How to Create a Toggle Switch using CSS"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/09\/how-to-create-toggle-switch-using-css-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-tn","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=1821"}],"version-history":[{"count":3,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1821\/revisions"}],"predecessor-version":[{"id":1825,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1821\/revisions\/1825"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/1822"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=1821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=1821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=1821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}