{"id":9822,"date":"2024-01-12T18:09:00","date_gmt":"2024-01-12T18:09:00","guid":{"rendered":"https:\/\/codehim.com\/?p=9822"},"modified":"2024-01-22T16:12:38","modified_gmt":"2024-01-22T11:12:38","slug":"draggable-div-element-in-html-css-javascript","status":"publish","type":"post","link":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/","title":{"rendered":"Draggable Div Element in HTML CSS &#038; JavaScript"},"content":{"rendered":"<p>This code implements a draggable div element in HTML, CSS, and JavaScript. The div element with the class <code>\"js-is-draggable\"<\/code> can be moved around the screen by clicking and dragging. The major functionality involves handling mouse or touch events to track the div&#8217;s position and update it accordingly.<\/p>\n<p>This feature is helpful for creating interactive user interfaces where draggable elements enhance the user experience by allowing them to rearrange elements on the page easily.<\/p>\n<h2>How to Create Draggable Div Element in HTML CSS &amp; JavaScript<\/h2>\n<p>1. First, in the <code>&lt;head&gt;<\/code> section of your HTML file, include the <a href=\"https:\/\/fontawesome.com\" target=\"_blank\" rel=\"noopener\">Normalize.css<\/a> CDN link to ensure a consistent styling base: (Optional)<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/normalize\/5.0.0\/normalize.min.css\"&gt;<\/pre>\n<p>2. Create a div element with the class &#8220;card&#8221; and &#8220;js-is-draggable&#8221;. This will be the element you can drag around:<\/p>\n<pre class=\"prettyprint linenums lang-html\">&lt;div class=\"card positioned js-is-draggable\" aria-grabbed=\"false\"&gt;Drag Me &#x1f389;&lt;\/div&gt;<\/pre>\n<p>3. Now, customize the appearance of your draggable div in the CSS section. The following code includes styles for a visually appealing and responsive draggable card:<\/p>\n<pre class=\"prettyprint linenums lang-css\">:root {\r\n  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif;\r\n  font-size: 16px;\r\n}\r\n\r\n.card {\r\n  display: flex;\r\n  justify-content: center;\r\n  align-items: center;\r\n  width: 20rem;\r\n  height: 10rem;\r\n  background-color: #efefef;\r\n  border-radius: .625rem;\r\n  box-shadow: 0 .0625rem .1875rem rgba(51, 51, 51, .12),\r\n    0 .0625rem .125rem rgba(51, 51, 51, .12);\r\n  transition: box-shadow 75ms linear;\r\n}\r\n\r\n.positioned {\r\n  position: relative;\r\n  top: 25%;\r\n  left: 25%;\r\n}\r\n\r\n.card:hover { cursor: move; }\r\n\r\n.card.js-is-dragging {\r\n  box-shadow: 0 .4375rem .875rem rgba(51, 51, 51, .25),\r\n    0 .3125rem .3125rem rgba(51, 51, 51, .22);\r\n}\r\n\r\n.js-is-draggable { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }<\/pre>\n<p>4. In the final step, copy the following JavaScript code to enable the dragging functionality. This code includes functions to handle mouse and touch events, updating the div&#8217;s position accordingly:<\/p>\n<pre class=\"prettyprint linenums lang-js\">let mover;\r\nlet offsets;\r\nlet position;\r\n\r\nfunction addEvent(type, callback, target = document) {target.addEventListener(type, callback, false);}\r\nfunction removeEvent(type, callback, target = document) {target.removeEventListener(type, callback);}\r\n\r\nfunction offsetPosition(target) {\r\n  let node = target;\r\n  let X = 0;\r\n  let Y = 0;\r\n\r\n  do {\r\n    X += node.offsetLeft;\r\n    Y += node.offsetTop;\r\n    node = node.offsetParent;\r\n  } while (\r\n  node);\r\n\r\n  return { X, Y };\r\n}\r\nfunction parentsUntilMatch(target, filter) {\r\n  if (!target || target.nodeType === 9) return null;\r\n  switch (true) {\r\n    case 'matchesSelector' in target:\r\n      if (target.matchesSelector(filter)) return target;\r\n      break;\r\n    case 'mozMatchesSelector' in target:\r\n      if (target.mozMatchesSelector(filter)) return target;\r\n      break;\r\n    case 'msMatchesSelector' in target:\r\n      if (target.msMatchesSelector(filter)) return target;\r\n      break;\r\n    case 'oMatchesSelector' in target:\r\n      if (target.oMatchesSelector(filter)) return target;\r\n      break;\r\n    case 'webkitMatchesSelector' in target:\r\n      if (target.webkitMatchesSelector(filter)) return target;\r\n      break;\r\n    default:\r\n      if (target.matches(filter)) return target;\r\n      break;}\r\n\r\n  return parentsUntilMatch(target.parentNode, filter);\r\n}\r\nfunction styleStringFromObj(obj) {\r\n  let str = '';\r\n\r\n  for (const prop in obj) {\r\n    str += `${prop}:${obj[prop]};`;\r\n  }\r\n\r\n  return str;\r\n}\r\n\r\nfunction mousedown(isTouch = false) {\r\n  const MOVE = isTouch ? 'touchmove' : 'mousemove';\r\n  const END = isTouch ? 'touchend' : 'mouseup';\r\n\r\n  return function caller(evt) {\r\n    const target = parentsUntilMatch(evt.target, '.js-is-draggable');\r\n\r\n    if (!target) return;\r\n\r\n    mover = target;\r\n    offsets = { X: evt.pageX, Y: evt.pageY };\r\n    position = offsetPosition(mover);\r\n    mover.setAttribute('style', styleStringFromObj({\r\n      position: 'relative',\r\n      top: `${position.Y}px`,\r\n      left: `${position.X}px` }));\r\n\r\n\r\n    mover.classList.add('js-is-dragging');\r\n    mover.setAttribute('aria-grabbed', true);\r\n\r\n    addEvent(MOVE, mousemove);\r\n    addEvent(END, mouseup(isTouch));\r\n  };\r\n}\r\nfunction mousemove(evt) {\r\n  \/\/ evt.preventDefault();\r\n  \/\/ new offsets based on mouse position\r\n  const newOffsets = {\r\n    X: evt.pageX,\r\n    Y: evt.pageY };\r\n\r\n\r\n  const newY = position.Y + (newOffsets.Y - offsets.Y);\r\n  const newX = position.X + (newOffsets.X - offsets.X);\r\n\r\n  \/\/ update styles\r\n  mover.style.top = newY + 'px';\r\n  mover.style.left = newX + 'px';\r\n\r\n  \/\/ update object\r\n  offsets = newOffsets;\r\n\r\n  \/\/ update position\r\n  position = { X: newX, Y: newY };\r\n}\r\nfunction mouseup(isTouch = false) {\r\n  const MOVE = isTouch ? 'touchmove' : 'mousemove';\r\n  const END = isTouch ? 'touchend' : 'mouseup';\r\n\r\n  return function caller(evt) {\r\n    removeEvent(MOVE, mousemove);\r\n    removeEvent(END, caller);\r\n\r\n    mover.classList.remove('js-is-dragging');\r\n    mover.setAttribute('aria-grabbed', false);\r\n\r\n    mover = offsets = position = undefined;\r\n  };\r\n}\r\n\r\naddEvent('mousedown', mousedown());\r\naddEvent('touchstart', mousedown(true));<\/pre>\n<p>Feel free to customize the card&#8217;s size, appearance, and additional styles to match your website&#8217;s design<\/p>\n<p>That&#8217;s all! hopefully, you have successfully created a draggable div element 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 draggable div element in HTML, CSS, and JavaScript. The div element with the class &#8220;js-is-draggable&#8221; can&#8230;<\/p>\n","protected":false},"author":1,"featured_media":9827,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[63],"tags":[237],"class_list":["post-9822","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5-css3","tag-drag-and-drop"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Draggable Div Element in HTML CSS &amp; JavaScript &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a Draggable Div Element in HTML CSS &amp; JavaScript. 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\/draggable-div-element-in-html-css-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Draggable Div Element in HTML CSS &amp; JavaScript &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a Draggable Div Element in HTML CSS &amp; JavaScript. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/\" \/>\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-01-12T18:09:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T11:12:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"Draggable Div Element in HTML CSS &#038; JavaScript\",\"datePublished\":\"2024-01-12T18:09:00+00:00\",\"dateModified\":\"2024-01-22T11:12:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/\"},\"wordCount\":231,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png\",\"keywords\":[\"Drag and Drop\"],\"articleSection\":[\"HTML5 &amp; CSS3\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/\",\"url\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/\",\"name\":\"Draggable Div Element in HTML CSS & JavaScript &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png\",\"datePublished\":\"2024-01-12T18:09:00+00:00\",\"dateModified\":\"2024-01-22T11:12:38+00:00\",\"description\":\"Here is a free code snippet to create a Draggable Div Element in HTML CSS & JavaScript. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png\",\"width\":1280,\"height\":960,\"caption\":\"Draggable Div Element in HTML CSS & JavaScript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#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\":\"Draggable Div Element in HTML CSS &#038; JavaScript\"}]},{\"@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":"Draggable Div Element in HTML CSS & JavaScript &#8212; CodeHim","description":"Here is a free code snippet to create a Draggable Div Element in HTML CSS & JavaScript. 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\/draggable-div-element-in-html-css-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Draggable Div Element in HTML CSS & JavaScript &#8212; CodeHim","og_description":"Here is a free code snippet to create a Draggable Div Element in HTML CSS & JavaScript. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-12T18:09:00+00:00","article_modified_time":"2024-01-22T11:12:38+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.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":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"Draggable Div Element in HTML CSS &#038; JavaScript","datePublished":"2024-01-12T18:09:00+00:00","dateModified":"2024-01-22T11:12:38+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/"},"wordCount":231,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png","keywords":["Drag and Drop"],"articleSection":["HTML5 &amp; CSS3"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/","url":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/","name":"Draggable Div Element in HTML CSS & JavaScript &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png","datePublished":"2024-01-12T18:09:00+00:00","dateModified":"2024-01-22T11:12:38+00:00","description":"Here is a free code snippet to create a Draggable Div Element in HTML CSS & JavaScript. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/Draggable-Div-Element-in-HTML-CSS-JavaScript.png","width":1280,"height":960,"caption":"Draggable Div Element in HTML CSS & JavaScript"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/html5-css3\/draggable-div-element-in-html-css-javascript\/#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":"Draggable Div Element in HTML CSS &#038; JavaScript"}]},{"@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":1850,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9822","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=9822"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9822\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/9827"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=9822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=9822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=9822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}