{"id":11167,"date":"2022-05-13T12:17:00","date_gmt":"2022-05-13T10:17:00","guid":{"rendered":"https:\/\/pagepro.co\/blog\/?p=11167"},"modified":"2024-09-20T15:19:09","modified_gmt":"2024-09-20T13:19:09","slug":"html-css-vs-javascript","status":"publish","type":"post","link":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/","title":{"rendered":"When HTML &#038; CSS Replace Javascript: A Simple Element Cheatsheet"},"content":{"rendered":"\n<p>There&#8217;s a tendency to think that JavaScript is clearly superior to HTML &amp; <a href=\"https:\/\/pagepro.co\/blog\/css-variables-what-they-are-and-how-to-use-them\/\">CSS<\/a> in every aspect. However, as I will show you in this short, code-ridden article, that&#8217;s not the case for all elements. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-bother-with-html-css\">Why Bother With HTML &amp; CSS?<\/h2>\n\n\n\n<p><strong>Too much Javascript can slow down your website. <\/strong><\/p>\n\n\n\n<p>Generally speaking, as a developer in an experienced <a href=\"https:\/\/pagepro.co\/services\/reactjs-development\" target=\"_blank\" rel=\"noreferrer noopener\">React company<\/a>, I&#8217;m a firm believer in HMTL and CSS. I believe that whenever you don&#8217;t need to use JavaScript &#8211; you shouldn&#8217;t. There are plenty of cases where instead of JS you can use pure HTML &amp; CSS achieving the same result with lighter code. <\/p>\n\n\n\n<p>In this article, I&#8217;m going to show you a couple of elements you can create without JavaScript. <\/p>\n\n\n\n<p>Feel free to copy-paste the code to your editor! <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1-accordion\">1: Accordion<\/h2>\n\n\n\n<p>There are quite a few ways we can build accordions without writing a single line of JS. Here I&#8217;m going to show you two quick and pain-free ways you can get it done with just HTML &amp; CSS.<\/p>\n\n\n\n<p>1. The first one is based on natively embedded HTML5 tags:<\/p>\n\n\n\n<ol>\n<li>&lt;details&gt;<\/li>\n\n\n\n<li>&lt;summary&gt;<\/li>\n<\/ol>\n\n\n\n<p>Disclaimer: Unfortunately, these tags are not supported by the Internet Explorer browser.<\/p>\n\n\n\n<pre class=\"wp-block-code-mind-code c-code\"><code class=\"html\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n  &lt;head>\n    &lt;meta charset=\"UTF-8\" \/>\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" \/>\n    &lt;title>Static Template&lt;\/title>\n    &lt;link rel=\"stylesheet\" href=\"style.css\" \/>\n  &lt;\/head>\n  &lt;body>\n    &lt;details class=\"accordion\">\n      &lt;summary class=\"accordion__head\">\n        &lt;h3 class=\"accordion__title\">\n          How will we conduct IEP and 504 meetings?\n        &lt;\/h3>\n      &lt;\/summary>\n      &lt;div class=\"accordion__content\">\n        &lt;p>All meetings will be held remotely.&lt;\/p>\n      &lt;\/div>\n    &lt;\/details>\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n\n\n\n<p>There are two widely-occurring issues with default summary styling. But there are also easy fixes that take care of the problem.<\/p>\n\n\n\n<ol>\n<li>The first issue lies with the cursor. By default, the hover pointer in the summary tag is set to a <strong>text cursor<\/strong> which may be confusing to the user. In order to fix this, we&#8217;ve simply added a <strong>cursor: pointer<\/strong> to the summary tag.<\/li>\n\n\n\n<li>The second is that the headings are set to <strong>{display:&nbsp;block;} by default. <\/strong>If we want to use headings as text tags in the summary tag, we need to set <strong>{display:&nbsp;inline;}<\/strong> to all elements inside the summary tag.<\/li>\n<\/ol>\n\n\n\n<p>You can use the above code in a Q&amp;A section, for example. This is what it&#8217;s going to look like:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/8qT70sJ60SJppg1yliwunY7VNOdNihjBIpHEeR0F9BNKFKL_5jKYg62uPYm5y38Wxs7zPK8Gt7bByo962MohKw1tEOiRwjSbq6YT50Kc45w3OgLF2JF0thXjrqD3VozEAvhMKMw2\" alt=\"\"\/><\/figure>\n\n\n\n<p>2. The second way to create an accordion without using JS is <strong>based on input, either radio or checkbox<\/strong>. This method is a little bit more complex but works with all browsers. <\/p>\n\n\n\n<p>Here is all code that you need to make it work:<\/p>\n\n\n\n<pre class=\"wp-block-code-mind-code c-code\"><code class=\"html\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n  &lt;head>\n    &lt;meta charset=\"UTF-8\" \/>\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" \/>\n    &lt;title>Static Template&lt;\/title>\n    &lt;link rel=\"stylesheet\" href=\"style.css\" \/>\n  &lt;\/head>\n  &lt;body>\n    &lt;div class=\"wrapper\">\n      &lt;div class=\"accordion\">\n        &lt;input\n          class=\"accordion__input\"\n          type=\"radio\"\n          name=\"question\"\n          id=\"question1\"\n        \/>\n        &lt;label class=\"accordion__title\" for=\"question1\"\n          >Why React is better than Angular?&lt;\/label\n        >\n        &lt;p class=\"accordion__content\">:)&lt;\/p>\n      &lt;\/div>\n      &lt;div class=\"accordion\">\n        &lt;input\n          class=\"accordion__input\"\n          type=\"radio\"\n          name=\"question\"\n          id=\"question2\"\n        \/>\n        &lt;label class=\"accordion__title\" for=\"question2\"\n          >Why React is better than Angular?&lt;\/label\n        >\n        &lt;p class=\"accordion__content\">:)&lt;\/p>\n      &lt;\/div>\n    &lt;\/div>\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n\n\n\n<p>As mentioned before, this method relies on the use of inputs that give us control over the opening and closing of accordions.<\/p>\n\n\n\n<div class=\"wp-block-code-mind-cta c-cta-block\" style=\"background-color:#00141F;color:#FFFFFF\"><div class=\"c-cta-block__content\"><p class=\"c-cta-block__title\">Get your code clean<\/p><div class=\"c-cta-block__action\"><a href=\"https:\/\/pagepro.co\/consultation\" class=\"c-cta-block__button ga-cta ga-cta-consultation theme-bg-3\">SCHEDULE A FREE CALL WITH OUR EXPERT. <\/a><\/div><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-modal-and-popup\">2. Modal and Popup<\/h2>\n\n\n\n<p>Other cool stuff we can create with just HTML and CSS are modals and popups. It is possible to do this thanks to the <strong>pseudo-class :target<\/strong>, which <strong>joins the URL hash with the id of an element <\/strong>(e.g. href=&#8221;#popup&#8221; and id=&#8221;popup&#8221;). <\/p>\n\n\n\n<p>Keep in mind that when dealing with this modal and popup, the biggest issue is that when you open a modal\/popup, the website will jump to a given element.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<ol>\n<li>Take a look at this modal first. It&#8217;s turned on and off by pressing the button.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code-mind-code c-code\"><code class=\"html\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n  &lt;head>\n    &lt;meta charset=\"UTF-8\" \/>\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" \/>\n    &lt;title>Static Template&lt;\/title>\n    &lt;link rel=\"stylesheet\" href=\"style.css\" \/>\n  &lt;\/head>\n  &lt;body>\n    &lt;div class=\"wrapper\">\n      &lt;a class=\"button\" href=\"#modal\">Open modal&lt;\/a>\n      &lt;div class=\"modal\" id=\"modal\">\n        &lt;div class=\"modal__inner\">\n          &lt;a class=\"modal__close\" href=\"#\">Close modal&lt;\/a>\n          &lt;div class=\"modal__content\">\n            &lt;p>Content goes here&lt;\/p>\n          &lt;\/div>\n        &lt;\/div>\n      &lt;\/div>\n    &lt;\/div>\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n\n\n\n<ol start=\"2\">\n<li>The next thing you can use the :target for, is the popup window, which can be disabled by clicking outside the content of our popup window.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code-mind-code c-code\"><code class=\"html\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n  &lt;head>\n    &lt;meta charset=\"UTF-8\" \/>\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" \/>\n    &lt;title>Static Template&lt;\/title>\n    &lt;link rel=\"stylesheet\" href=\"style.css\" \/>\n  &lt;\/head>\n  &lt;body>\n    &lt;div class=\"wrapper\">\n      &lt;a class=\"button\" href=\"#popup\">Open modal&lt;\/a>\n      &lt;div class=\"popup\" id=\"popup\">\n        &lt;a href=\"#\" class=\"popup__close\">&lt;\/a>\n        &lt;div class=\"popup__inner\">\n          &lt;div class=\"popup__content\">\n            &lt;p>Content goes here&lt;\/p>\n          &lt;\/div>\n        &lt;\/div>\n      &lt;\/div>\n    &lt;\/div>\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n\n\n\n    \n    <div class=\"c-poll-block\">\n        <div class=\"c-poll-block__icon\">\n            <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n            <path d=\"M19.125 1.12503C16.3182 1.12098 13.5615 1.86815 11.1408 3.28899C8.72023 4.70983 6.72396 6.75258 5.3592 9.20524C3.99443 11.6579 3.31089 14.4311 3.37953 17.2371C3.44816 20.043 4.26646 22.7795 5.7495 25.1625L1.125 34.875L10.836 30.249C12.907 31.5372 15.2489 32.3268 17.6771 32.5556C20.1052 32.7843 22.5534 32.4461 24.8286 31.5674C27.1037 30.6888 29.1438 29.2938 30.7879 27.4923C32.432 25.6909 33.6353 23.5322 34.3029 21.1864C34.9706 18.8406 35.0843 16.3718 34.6352 13.9746C34.186 11.5774 33.1863 9.31722 31.7148 7.37223C30.2432 5.42723 28.3401 3.85056 26.1554 2.76646C23.9706 1.68236 21.5639 1.12046 19.125 1.12503V1.12503Z\" stroke=\"white\" stroke-width=\"2.25\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/>\n            <path d=\"M19.5 22C19.2033 22 18.9133 22.088 18.6666 22.2528C18.42 22.4176 18.2277 22.6519 18.1142 22.926C18.0006 23.2001 17.9709 23.5017 18.0288 23.7926C18.0867 24.0836 18.2296 24.3509 18.4393 24.5607C18.6491 24.7704 18.9164 24.9133 19.2074 24.9712C19.4983 25.0291 19.7999 24.9994 20.074 24.8858C20.3481 24.7723 20.5824 24.58 20.7472 24.3334C20.912 24.0867 21 23.7967 21 23.5C21 23.1022 20.842 22.7206 20.5607 22.4393C20.2794 22.158 19.8978 22 19.5 22Z\" fill=\"white\"\/>\n            <path d=\"M14.625 14.625C14.625 13.735 14.8889 12.865 15.3834 12.1249C15.8779 11.3849 16.5807 10.8081 17.4029 10.4675C18.2252 10.1269 19.13 10.0378 20.0029 10.2115C20.8758 10.3851 21.6776 10.8137 22.307 11.443C22.9363 12.0724 23.3649 12.8742 23.5385 13.7471C23.7122 14.62 23.6231 15.5248 23.2825 16.3471C22.9419 17.1693 22.3651 17.8721 21.6251 18.3666C20.885 18.8611 20.015 19.125 19.125 19.125\" stroke=\"white\" stroke-width=\"2.25\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/>\n            <\/svg>\n        <\/div>\n        <p class=\"c-poll-block__heading\">Quick poll<\/p>\n        <p class=\"c-poll-block__question\">What do you prefer to code with?<\/p>\n\n        <form method=\"POST\" action=\"https:\/\/pagepro.co\/blog\/wp-admin\/admin-ajax.php\" class=\"js-poll-form\">\n            <input type=\"hidden\" class=\"js-poll-action\" id=\"action\" name=\"action\" value=\"poll_ajax\">\n            <input type=\"hidden\" class=\"js-poll-id\" id=\"poll_id\" name=\"poll_id\" value=\"11284\">\n            \n            <div class=\"c-poll-block__answer-list js-poll-answers\">\n                 \n                                            <div class=\"c-poll-block__answer\">\n                            <input type=\"button\" name=\"1\" value=\"HTML &#038; CSS\" class=\"js-poll-answer \" >\n                        <\/div>\n                                                         \n                                            <div class=\"c-poll-block__answer\">\n                            <input type=\"button\" name=\"2\" value=\"JavaScript\" class=\"js-poll-answer \" >\n                        <\/div>\n                                                         \n                                            <div class=\"c-poll-block__answer\">\n                            <input type=\"button\" name=\"3\" value=\"Other (let us know in the comments!)\" class=\"js-poll-answer \" >\n                        <\/div>\n                                                                    <\/div>\n            <div class=\"c-poll-block__total-votes\"><span class=\"js-poll-total\">133<\/span> votes<\/div>\n        <\/form>\n    <\/div>\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-tooltip\">3. Tooltip<\/h2>\n\n\n\n<p>Next is the tooltip. It works a bit like the modal and popup examples above. However, the tooltip shows up on the hover. To show the content that we put into aria-label, we pass it in the CSS attribute content with the value content: attr(aria-label).<\/p>\n\n\n\n<pre class=\"wp-block-code-mind-code c-code\"><code class=\"html\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n  &lt;head>\n    &lt;meta charset=\"UTF-8\" \/>\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" \/>\n    &lt;title>Static Template&lt;\/title>\n    &lt;link rel=\"stylesheet\" href=\"style.css\" \/>\n  &lt;\/head>\n  &lt;body>\n    &lt;div class=\"wrapper\">\n      &lt;p>\n        This is how a\n        &lt;a\n          href=\"#\"\n          class=\"tooltip\"\n          aria-label=\"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"\n          >tooltip&lt;\/a\n        >\n        works without JS\n      &lt;\/p>\n    &lt;\/div>\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n\n\n\n<div class=\"c-newsletter-block-acf\">\n    <p class=\"c-newsletter-block-acf__title c-newsletter__header\">\n        EXPERT INSIGHTS, FRICTIONLESSLY DELIVERED!    <\/p>\n    <p class=\"c-newsletter-block-acf__desc c-newsletter__header\">\n        Curated tech news delivered straight to your inbox every month.\r\n    <\/p>\n    <form method=\"post\" class=\"c-newsletter-block-acf__form js-newsletter-form c-newsletter__action\" name=\"newsletter-block-form\">\n        <input name=\"newsletter-email\" id=\"newsletter-email\" type=\"text\" class=\"c-newsletter-block-acf__input js-newsletter-input\" placeholder=\"Company Email\" \/>\n        <input name=\"newsletter-campaign\" id=\"newsletter-campaign\" type=\"hidden\" value=\"\" \/>\n        <div class=\"c-newsletter-block-acf__group\">\n            <input name=\"consent\" id=\"consent\" type=\"checkbox\" class=\"js-newsletter-consent\" \/>\n            <label class=\"c-newsletter-block-acf__label\" for=\"consent\">I accept the <a href=\"https:\/\/pagepro.co\/privacy-policy\">Privacy Policy<\/a> and agree to process my personal data by Pagepro for marketing purposes.<\/label>\n        <\/div>\n        <input type=\"submit\" class=\"c-newsletter-block-acf__button button js-newsletter-sub ga-newsletter-form-content\" value=\"Sign up\" \/>\n        <p class=\"theme-size-1 js-message-valid is-hidden is-invalid\"><\/p>\n    <\/form>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4-star-rating\">4. Star Rating<\/h2>\n\n\n\n<p>The last thing will be the functionality useful for ratings (e.g. dishes\/hotels), i.e. star rating. The code will be based on radio inputs and labels.<\/p>\n\n\n\n<pre class=\"wp-block-code-mind-code c-code\"><code class=\"html\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n  &lt;head>\n    &lt;meta charset=\"UTF-8\" \/>\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" \/>\n    &lt;title>Static Template&lt;\/title>\n    &lt;link rel=\"stylesheet\" href=\"style.css\" \/>\n  &lt;\/head>\n  &lt;body>\n    &lt;div class=\"wrapper\">\n      &lt;input type=\"radio\" class=\"star\" name=\"rating\" id=\"star-5\" \/>\n      &lt;label class=\"star-label\" for=\"star-5\">*&lt;\/label>\n      &lt;input type=\"radio\" class=\"star\" name=\"rating\" id=\"star-4\" \/>\n      &lt;label class=\"star-label\" for=\"star-4\">*&lt;\/label>\n      &lt;input type=\"radio\" class=\"star\" name=\"rating\" id=\"star-3\" \/>\n      &lt;label class=\"star-label\" for=\"star-3\">*&lt;\/label>\n      &lt;input type=\"radio\" class=\"star\" name=\"rating\" id=\"star-2\" \/>\n      &lt;label class=\"star-label\" for=\"star-2\">*&lt;\/label>\n      &lt;input type=\"radio\" class=\"star\" name=\"rating\" id=\"star-1\" \/>\n      &lt;label class=\"star-label\" for=\"star-1\">*&lt;\/label>\n    &lt;\/div>\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"summary\">Summary<\/h2>\n\n\n\n<p>As you can see, JavaScript can easily be replaced with just HTML &amp; CSS. <\/p>\n\n\n\n<p>Pseudo-classes such as <strong>target<\/strong>, <strong>focus<\/strong>, <strong>checked<\/strong>, can replace JS functions making your code lighter. Some of these CSS examples can be considered tricky, but are efficient, flexible, and well worth it.<\/p>\n\n\n\n<p>The examples above are only a couple of cool things you can do. In reality, you can use HTML &amp; CSS to replace dozens of different functions.<\/p>\n\n\n\n<p>What are your thoughts on replacing JS with HTML and CSS? Feel free to share your opinion and any examples of your work down in the comments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"read-more\">Read More<\/h2>\n\n\n\n<p><a href=\"https:\/\/pagepro.co\/blog\/javascript-frameworks-and-libraries\">JavaScript Framework And Libraries<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/pagepro.co\/blog\/typescript-vs-javascript\">TypeScript vs JavaScript<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/pagepro.co\/blog\/why-react-native-updates-are-important\">Why React Native Updates Are Important?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create cool HTML &#038; CSS-based elements without having to use JavaScript.<\/p>\n","protected":false},"author":13,"featured_media":11272,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[84,318],"tags":[23,575,19,573,574,572,6],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>When HTML &amp; CSS Replace Javascript: A Simple Element Cheatsheet - Pagepro<\/title>\n<meta name=\"description\" content=\"Throw away your preconceptions about HTML and CSS out the window. Build lightweight and flexible elements without using JavaScript!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"When HTML &amp; CSS Replace Javascript: A Simple Element Cheatsheet - Pagepro\" \/>\n<meta property=\"og:description\" content=\"Throw away your preconceptions about HTML and CSS out the window. Build lightweight and flexible elements without using JavaScript!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Pagepro\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/thisispagepro\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-13T10:17:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-20T13:19:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pagepro.co\/blog\/wp-content\/uploads\/2022\/04\/Header.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1032\" \/>\n\t<meta property=\"og:image:height\" content=\"576\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Joanna Chmiel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joanna Chmiel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/\"},\"author\":{\"name\":\"Joanna Chmiel\",\"@id\":\"https:\/\/pagepro.co\/blog\/#\/schema\/person\/f5c17e95374689202f939d378ae505ba\"},\"headline\":\"When HTML &#038; CSS Replace Javascript: A Simple Element Cheatsheet\",\"datePublished\":\"2022-05-13T10:17:00+00:00\",\"dateModified\":\"2024-09-20T13:19:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/\"},\"wordCount\":719,\"publisher\":{\"@id\":\"https:\/\/pagepro.co\/blog\/#organization\"},\"keywords\":[\"css\",\"elements html\",\"html\",\"html css vs javascript\",\"html element\",\"html vs javascript\",\"javascript\"],\"articleSection\":[\"React JS\",\"Web Development\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/\",\"url\":\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/\",\"name\":\"When HTML & CSS Replace Javascript: A Simple Element Cheatsheet - Pagepro\",\"isPartOf\":{\"@id\":\"https:\/\/pagepro.co\/blog\/#website\"},\"datePublished\":\"2022-05-13T10:17:00+00:00\",\"dateModified\":\"2024-09-20T13:19:09+00:00\",\"description\":\"Throw away your preconceptions about HTML and CSS out the window. Build lightweight and flexible elements without using JavaScript!\",\"breadcrumb\":{\"@id\":\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/pagepro.co\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Blog\",\"item\":\"https:\/\/pagepro.co\/blog\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"When HTML &#038; CSS Replace Javascript: A Simple Element Cheatsheet\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pagepro.co\/blog\/#website\",\"url\":\"https:\/\/pagepro.co\/blog\/\",\"name\":\"Pagepro\",\"description\":\"Frictionless Next.js, Expo &amp; Sanity Development Blog\",\"publisher\":{\"@id\":\"https:\/\/pagepro.co\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/pagepro.co\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/pagepro.co\/blog\/#organization\",\"name\":\"Pagepro\",\"url\":\"https:\/\/pagepro.co\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pagepro.co\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/pagepro.co\/blog\/wp-content\/uploads\/2020\/08\/logo_pagepro-b66d228a1e-1.png\",\"contentUrl\":\"https:\/\/pagepro.co\/blog\/wp-content\/uploads\/2020\/08\/logo_pagepro-b66d228a1e-1.png\",\"width\":440,\"height\":200,\"caption\":\"Pagepro\"},\"image\":{\"@id\":\"https:\/\/pagepro.co\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/thisispagepro\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/pagepro.co\/blog\/#\/schema\/person\/f5c17e95374689202f939d378ae505ba\",\"name\":\"Joanna Chmiel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pagepro.co\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/36f6118b3adb3b1dd7162ede2bfc9196?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/36f6118b3adb3b1dd7162ede2bfc9196?s=96&d=mm&r=g\",\"caption\":\"Joanna Chmiel\"},\"description\":\"Asia, a key member of the Pagepro team since 2017, shines as an expert in UI and Frontend development. Her role at Pagepro goes beyond mere coding; she brings life and functionality to user interfaces, ensuring that each project is not only visually appealing but also intuitively navigable and user-friendly.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/joanna-chmiel-319756164\/\"],\"url\":\"https:\/\/pagepro.co\/blog\/author\/joanna-dyszkiewicz\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"When HTML & CSS Replace Javascript: A Simple Element Cheatsheet - Pagepro","description":"Throw away your preconceptions about HTML and CSS out the window. Build lightweight and flexible elements without using JavaScript!","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:\/\/pagepro.co\/blog\/html-css-vs-javascript\/","og_locale":"en_US","og_type":"article","og_title":"When HTML & CSS Replace Javascript: A Simple Element Cheatsheet - Pagepro","og_description":"Throw away your preconceptions about HTML and CSS out the window. Build lightweight and flexible elements without using JavaScript!","og_url":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/","og_site_name":"Pagepro","article_publisher":"https:\/\/www.facebook.com\/thisispagepro","article_published_time":"2022-05-13T10:17:00+00:00","article_modified_time":"2024-09-20T13:19:09+00:00","og_image":[{"width":1032,"height":576,"url":"https:\/\/pagepro.co\/blog\/wp-content\/uploads\/2022\/04\/Header.png","type":"image\/png"}],"author":"Joanna Chmiel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Joanna Chmiel","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/#article","isPartOf":{"@id":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/"},"author":{"name":"Joanna Chmiel","@id":"https:\/\/pagepro.co\/blog\/#\/schema\/person\/f5c17e95374689202f939d378ae505ba"},"headline":"When HTML &#038; CSS Replace Javascript: A Simple Element Cheatsheet","datePublished":"2022-05-13T10:17:00+00:00","dateModified":"2024-09-20T13:19:09+00:00","mainEntityOfPage":{"@id":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/"},"wordCount":719,"publisher":{"@id":"https:\/\/pagepro.co\/blog\/#organization"},"keywords":["css","elements html","html","html css vs javascript","html element","html vs javascript","javascript"],"articleSection":["React JS","Web Development"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/","url":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/","name":"When HTML & CSS Replace Javascript: A Simple Element Cheatsheet - Pagepro","isPartOf":{"@id":"https:\/\/pagepro.co\/blog\/#website"},"datePublished":"2022-05-13T10:17:00+00:00","dateModified":"2024-09-20T13:19:09+00:00","description":"Throw away your preconceptions about HTML and CSS out the window. Build lightweight and flexible elements without using JavaScript!","breadcrumb":{"@id":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/pagepro.co\/blog\/html-css-vs-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pagepro.co\/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https:\/\/pagepro.co\/blog\/"},{"@type":"ListItem","position":3,"name":"When HTML &#038; CSS Replace Javascript: A Simple Element Cheatsheet"}]},{"@type":"WebSite","@id":"https:\/\/pagepro.co\/blog\/#website","url":"https:\/\/pagepro.co\/blog\/","name":"Pagepro","description":"Frictionless Next.js, Expo &amp; Sanity Development Blog","publisher":{"@id":"https:\/\/pagepro.co\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pagepro.co\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pagepro.co\/blog\/#organization","name":"Pagepro","url":"https:\/\/pagepro.co\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pagepro.co\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pagepro.co\/blog\/wp-content\/uploads\/2020\/08\/logo_pagepro-b66d228a1e-1.png","contentUrl":"https:\/\/pagepro.co\/blog\/wp-content\/uploads\/2020\/08\/logo_pagepro-b66d228a1e-1.png","width":440,"height":200,"caption":"Pagepro"},"image":{"@id":"https:\/\/pagepro.co\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/thisispagepro"]},{"@type":"Person","@id":"https:\/\/pagepro.co\/blog\/#\/schema\/person\/f5c17e95374689202f939d378ae505ba","name":"Joanna Chmiel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pagepro.co\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/36f6118b3adb3b1dd7162ede2bfc9196?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/36f6118b3adb3b1dd7162ede2bfc9196?s=96&d=mm&r=g","caption":"Joanna Chmiel"},"description":"Asia, a key member of the Pagepro team since 2017, shines as an expert in UI and Frontend development. Her role at Pagepro goes beyond mere coding; she brings life and functionality to user interfaces, ensuring that each project is not only visually appealing but also intuitively navigable and user-friendly.","sameAs":["https:\/\/www.linkedin.com\/in\/joanna-chmiel-319756164\/"],"url":"https:\/\/pagepro.co\/blog\/author\/joanna-dyszkiewicz\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/posts\/11167"}],"collection":[{"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/comments?post=11167"}],"version-history":[{"count":21,"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/posts\/11167\/revisions"}],"predecessor-version":[{"id":17884,"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/posts\/11167\/revisions\/17884"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/media\/11272"}],"wp:attachment":[{"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/media?parent=11167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/categories?post=11167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pagepro.co\/blog\/wp-json\/wp\/v2\/tags?post=11167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}