<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CSS &#8211; Marcos Rego</title>
	<atom:link href="https://marcosrego.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>https://marcosrego.com</link>
	<description>Web Development</description>
	<lastBuildDate>Mon, 11 Mar 2024 23:24:00 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.1</generator>
	<item>
		<title>Create custom utility classes and breakpoints for Mr.Utils</title>
		<link>https://marcosrego.com/blog/custom-utility-classes-breakpoints/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Sat, 27 Jan 2024 19:13:33 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[For developers]]></category>
		<category><![CDATA[Mr.Dev.'s Framework]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=3083</guid>

					<description><![CDATA[Mr.Utils includes a good preset of utility classes, for spacing, colors, sizes, components and much more. And when using it on WordPress, you and other users can even select them via the block editor. But there might be occasions, that you need to have your own custom classes, and you might want them to be [&#8230;]]]></description>
										<content:encoded><![CDATA[<span id="more-3083"></span>
<!--noteaser-->



<p>Mr.Utils includes a good preset of utility classes, for spacing, colors, sizes, components and much more. And when using it on WordPress, you and other users can even select them via the block editor.</p>



<p>But there might be occasions, that you need to have your own custom classes, and you might want them to be available on the editor also.</p>



<p>And maybe you want to use those custom classes on specific breakpoints: The 4 preset breakpoints might not be enough for you, if that&#8217;s the case, you can also create custom breakpoints.</p>



<p>On this tutorial, you will learn how you can add your own custom utility classes and breakpoints to Mr.Utils. There are two ways to do it:</p>



<ul class="wp-block-list">
<li><strong>Using Mr.Dev.&#8217;s Framework</strong> &#8211; is the easiest way on WordPress.</li>



<li><strong>Manual implementation on Mr.Utils</strong></li>
</ul>



<aside class="  wp-block-group sidebar has-main-text-color-color has-aside-background-color-background-color has-text-color has-background"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<section class="wp-block-group has-main-text-color-color has-main-background-color-background-color has-text-color has-background"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<h3 class="   has-main-text-color-color has-text-color wp-block-heading"><strong>Did you know?</strong></h3>



<figure class="    wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="538" src="https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-1024x538.png" alt="Mr.Utils Opengraph Image" class="wp-image-1029" title="mrutils marcosrego opengraph - Create custom utility classes and breakpoints for Mr.Utils" srcset="https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-1024x538.png 1024w, https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-300x158.png 300w, https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-768x403.png 768w, https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="  has-main-text-color-color has-text-color"><strong><a href="https://marcosrego.com/development/mr-utils/" data-type="post" data-id="473">Mr.Utils</a></strong> gives you a set of classes with a clear syntax, such as <em><strong>mr-phone-hide</strong></em> clearly saying to hide an element on a phone, <strong><em>mr-marginright</em></strong> to add a margin on the right side of an element and <strong><a rel="noreferrer noopener" href="https://github.com/marcosrego-web/mr-utils/wiki/Utility-Classes" data-type="URL" data-id="https://github.com/marcosrego-web/mr-utils/wiki/Utility-Classes" target="_blank">so much more</a></strong>&#8230;</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-invert-color-color has-link-color-background-color has-text-color has-background" href="https://marcosrego.com/client-area/downloads/?product=mrutils"><strong>Get it now (free)</strong></a></div>
</div>
</div></section>
</div></aside>



<h2 class="wp-block-heading" id="using-mr-dev-s-framework-on-wordpress"><strong>Using Mr.Dev.&#8217;s Framework on WordPress</strong></h2>



<h3 class="  wp-block-heading" id="create-custom-utility-classes-using-mr-dev-s-framework"><strong>Create custom utility classes using Mr.Dev.&#8217;s Framework</strong></h3>



<ol class="  wp-block-list">
<li>Once on WordPress, go to &#8220;Settings&#8221; &gt; &#8220;Mr.Dev.&#8221; (or your website name, depending of the configuration).</li>



<li>Go to the &#8220;Utilities&#8221; tab (If the tab is not available, you&#8217;ll need to enable the option on the &#8220;Configuration&#8221; tab, at &#8220;Utilities configuration&#8221;).</li>



<li>On &#8220;Default options&#8221; click on &#8220;Choose available features&#8221; and select &#8220;Custom&#8221; on each breakpoint where you&#8217;ll want your custom classes to be available.</li>



<li>Below on &#8220;Custom Utilities&#8221;, click on + to add the first class.</li>



<li>Choose the class name (the class will be generated from this name).</li>



<li>Choose the CSS property (A list of some properties will appear while you write, those properties can be used for the block editor. You can still use any CSS property you want, even the ones not listed, the only downside is those might not appear on the block editor, you&#8217;ll need to copy &amp; paste the class).</li>



<li>Choose the CSS variable / value (If you have the &#8220;Styles&#8221; tab enabled, you can create the variables there, they will appear in here after. And you don&#8217;t have to use variables, you can also write the intended values directly here if you prefer.)</li>
</ol>



<p>Tip: If you want a class to have multiple properties, you can do it, by having the same class name repeated multiple times.</p>



<figure class="  wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><img decoding="async" width="1024" height="538" data-id="3104" src="https://marcosrego.com/wp-content/uploads/2024/01/mrdev-framework_mr-utils_custom-classes-1024x538.jpg" alt="custom utility classes on Mr.Utils with Mr.Dev.&#039;s Framework" class="wp-image-3104" title="mrdev framework mr utils custom classes - Create custom utility classes and breakpoints for Mr.Utils" srcset="https://marcosrego.com/wp-content/uploads/2024/01/mrdev-framework_mr-utils_custom-classes-1024x538.jpg 1024w, https://marcosrego.com/wp-content/uploads/2024/01/mrdev-framework_mr-utils_custom-classes-300x158.jpg 300w, https://marcosrego.com/wp-content/uploads/2024/01/mrdev-framework_mr-utils_custom-classes-768x403.jpg 768w, https://marcosrego.com/wp-content/uploads/2024/01/mrdev-framework_mr-utils_custom-classes.jpg 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</figure>



<h4 class="  wp-block-heading" id="using-the-custom-utility-classes"><strong>Using the custom utility classes</strong></h4>



<p>Once you create the custom utility classes, you will see inputs showing how the class looks for each breakpoint (that you selected on the 3rd step). You can click on the input to copy the class and then paste into your HTML, CSS, etc. </p>



<p>If the option &#8220;Show utilities on the block editor&#8221; is active, you can use the block editor to use the custom classes, for options related to spacing, coloring and sizes.</p>



<figure class="  wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><img decoding="async" width="772" height="250" data-id="2289" src="https://marcosrego.com/wp-content/uploads/2021/10/banner-772x250-1.png" alt="Mr.Utils options on WordPress block editor" class="wp-image-2289" title="banner 772x250 1 - Create custom utility classes and breakpoints for Mr.Utils" srcset="https://marcosrego.com/wp-content/uploads/2021/10/banner-772x250-1.png 772w, https://marcosrego.com/wp-content/uploads/2021/10/banner-772x250-1-300x97.png 300w, https://marcosrego.com/wp-content/uploads/2021/10/banner-772x250-1-768x249.png 768w" sizes="(max-width: 772px) 100vw, 772px" /><figcaption class="wp-element-caption">Mr.Utils options on WordPress block editor</figcaption></figure>
</figure>



<h3 class="  wp-block-heading" id="add-custom-breakpoints-using-mr-dev-s-framework"><strong>Add custom breakpoints using Mr.Dev.&#8217;s Framework</strong></h3>



<ol class="  wp-block-list">
<li>Once on WordPress, go to &#8220;Settings&#8221; &gt; &#8220;Mr.Dev.&#8221; (or your website name, depending of the configuration).</li>



<li>Go to the &#8220;Styles&#8221; tab (If the tab is not available, you&#8217;ll need to enable the option on the &#8220;Configuration&#8221; tab, at &#8220;Styles configuration&#8221;).</li>



<li>Scroll down to the &#8220;Breakpoints&#8221; section, where you will find 4 preset breakpoints already created, that you can change the values.</li>



<li>Click on &#8220;+&#8221; on &#8220;Number of Breakpoints&#8221; to add a custom breakpoint.</li>



<li>Choose the name for the breakpoint and define the min/max &#8211; width/height. </li>
</ol>



<figure class="  wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><img loading="lazy" decoding="async" width="951" height="963" data-id="2687" src="https://marcosrego.com/wp-content/uploads/2022/08/ressanogarciaarq-styles-base-breakpoints.jpg" alt="ressanogarciaarq styles base breakpoints" class="wp-image-2687" title="ressanogarciaarq styles base breakpoints - Create custom utility classes and breakpoints for Mr.Utils" srcset="https://marcosrego.com/wp-content/uploads/2022/08/ressanogarciaarq-styles-base-breakpoints.jpg 951w, https://marcosrego.com/wp-content/uploads/2022/08/ressanogarciaarq-styles-base-breakpoints-296x300.jpg 296w, https://marcosrego.com/wp-content/uploads/2022/08/ressanogarciaarq-styles-base-breakpoints-768x778.jpg 768w" sizes="auto, (max-width: 951px) 100vw, 951px" /><figcaption class="wp-element-caption">Example of using custom breakpoints on <a href="https://marcosrego.com/websites/ressanogarcia/" data-type="post" data-id="1795">Ressano Garcia Aquitectos website</a>.</figcaption></figure>
</figure>



<h4 class="  wp-block-heading" id="using-the-custom-breakpoints"><strong>Using the custom breakpoints</strong></h4>



<p>Once you create the custom breakpoints, you can select them on the &#8220;Utilities&#8221; tab or/and on the &#8220;Files / Media&#8221; tab. </p>



<p>On the &#8220;Files/Media&#8221; tab, you can choose on which breakpoints each spreadsheet should load (In production, do not forget to use a cache plugin with minifying options, to combine these spreadsheets, while keeping the breakpoints and their media queries).</p>



<figure class="  wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="693" data-id="956" src="https://marcosrego.com/wp-content/uploads/2021/06/mrdev-framework_files-1024x693.jpg" alt="Mr.Dev.&#039;s Framework - Files page" class="wp-image-956" title="mrdev framework files - Create custom utility classes and breakpoints for Mr.Utils" srcset="https://marcosrego.com/wp-content/uploads/2021/06/mrdev-framework_files-1024x693.jpg 1024w, https://marcosrego.com/wp-content/uploads/2021/06/mrdev-framework_files-300x203.jpg 300w, https://marcosrego.com/wp-content/uploads/2021/06/mrdev-framework_files-768x520.jpg 768w, https://marcosrego.com/wp-content/uploads/2021/06/mrdev-framework_files.jpg 1342w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">On the Files / Media tab you can decide on which breakpoints a stylesheet should load.</figcaption></figure>
</figure>



<h2 class="wp-block-heading" id="manual-implementation-on-mr-utils"><strong>Manual implementation on Mr.Utils</strong></h2>



<h3 class="  wp-block-heading" id="create-custom-utility-classes"><strong>Create custom utility classes</strong></h3>



<ol class="  wp-block-list">
<li><a href="https://marcosrego.com/client-area/downloads/?product=mrutils" target="_blank" data-type="link" data-id="https://marcosrego.com/client-area/downloads/?product=mrutils" rel="noreferrer noopener">Download Mr.Utils.</a></li>



<li>Go to &#8220;dev/css&#8221;. Each folder located in here corresponds to one breakpoint (except for &#8220;utils&#8221; that is global).</li>



<li>Go to each folder/breakpoint where you want your custom classes to be available and create a utils_<em>breakpoint</em>_custom.css file on each one.</li>



<li>Open all the created files and add a class, following the utilities rules. Example: &#8220;<code>.mr-<em>breakpoint</em>-fontsize10 { }</code>&#8220;.</li>



<li>Add the intended CSS properties to each class. Example: &#8220;<code>font-size: var(--font-size-10,60px);</code>&#8220;.</li>



<li>Once you created all classes on all utils_custom.css, go to the main file on each folder/breakpoint, titled &#8220;utils_<em>breakpoint</em>.css&#8221;.</li>



<li>Add the following line: <code>@import url("utils_<em>breakpoint</em>_custom.css"); </code>Replacing &#8220;breakpoint&#8221; with the actual breakpoint name.</li>



<li><strong>For development</strong>, you can load each of the main &#8220;dev/css/utils_<em>breakpoint</em>/utils_<em>breakpoint</em>.css&#8221; files, with media queries. <br><strong>For production,</strong> you should use your favourite compiler, to compile the main files into the main &#8220;css&#8221; folder (located in the root folder). Use media queries to load all files inside that folder and then, use a page/html minifier to join all those media queried files into one.</li>
</ol>



<h3 class="  wp-block-heading" id="add-custom-breakpoints"><strong>Add custom breakpoints</strong></h3>



<p>With more files you can add more breakpoint names and media queries:</p>



<ol class="  wp-block-list">
<li>Start by copying one of the given breakpoint files. For this example, copy the file &#8216;utils_desktop.css&#8217;.</li>



<li>Change the file name to the name of your breakpoint. For this example rename it &#8216;utils_notmobile.css&#8217; .</li>



<li>Use your favorite code editor to find and replace all instances of &#8216;-desktop-&#8216; with &#8216;-notmobile-&#8216;.</li>



<li>Save the file next to other breakpoints and load it with your own media query. For this example, the easiest would be to add the following to the&nbsp;<code>&lt;head&gt;</code>&nbsp;section:<br><code>&lt;link rel='stylesheet' href='mr-utils/css/utils_notmobile.css' media='(min-width: 768px)' /&gt;</code></li>
</ol>



<h2><b>Comments</b></h2>
<div id="disqus_thread"></div>
<script>
if(mrGetCookie('cookielawinfo-checkbox-functional') == 'yes') {
    var disqus_config = function () {
        this.page.url = (location.protocol+'//'+location.host+location.pathname).replace("/account/", "/");
        this.page.identifier = document.querySelector("article").id.replace("post-", "");
    };
    
    (function() {
    var d = document, s = d.createElement('script');
    s.src = 'https://marcosrego-web.disqus.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
    })();
} else {
    document.querySelector('#disqus_thread').innerHTML = 'You cannot view or add comments because you did not consent to the use of functional cookies: <a class="  cli_manage_current_consent" style="cursor:pointer;">Manage your consent.</a>';
}
</script>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to style a datalist and its options?</title>
		<link>https://marcosrego.com/blog/style-datalist-options/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Tue, 27 Dec 2022 20:10:17 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[For developers]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=2875</guid>

					<description><![CDATA[If you ever tried to change the look and feel of a HTML5 datalist but couldn’t, then this post might be your (delayed) Christmas present 🎄🎁 (I hope you had a great one and close to the ones you love the most)! What’s the problem of styling a HTML5 datalist? At the moment of writing, [&#8230;]]]></description>
										<content:encoded><![CDATA[<span id="more-2875"></span>
<!--noteaser-->



<p>If you ever tried to change the look and feel of a HTML5 datalist but couldn’t, then this post might be your (delayed) Christmas present 🎄🎁 (I hope you had a great one and close to the ones you love the most)!</p>



<aside class="  wp-block-group sidebar has-main-text-color-color has-aside-background-color-background-color has-text-color has-background"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<section class="wp-block-group has-main-text-color-color has-main-background-color-background-color has-text-color has-background"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<h3 class="   has-main-text-color-color has-text-color wp-block-heading"><strong>Did you know?</strong></h3>



<figure class="    wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="538" src="https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-1024x538.png" alt="Mr.Utils Opengraph Image" class="wp-image-1029" title="mrutils marcosrego opengraph - How to style a datalist and its options?" srcset="https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-1024x538.png 1024w, https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-300x158.png 300w, https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph-768x403.png 768w, https://marcosrego.com/wp-content/uploads/2021/06/mrutils-marcosrego-opengraph.png 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="  has-main-text-color-color has-text-color"><strong><a href="https://marcosrego.com/development/mr-utils/" data-type="post" data-id="473">Mr.Utils</a></strong> gives you a set of classes with a clear syntax, such as <em><strong>mr-phone-hide</strong></em> clearly saying to hide an element on a phone, <strong><em>mr-marginright</em></strong> to add a margin on the right side of an element and <strong><a rel="noreferrer noopener" href="https://github.com/marcosrego-web/mr-utils/wiki/Utility-Classes" data-type="URL" data-id="https://github.com/marcosrego-web/mr-utils/wiki/Utility-Classes" target="_blank">so much more</a></strong>&#8230;</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-invert-color-color has-link-color-background-color has-text-color has-background" href="https://marcosrego.com/client-area/downloads/?product=mrutils"><strong>Get it now (free)</strong></a></div>
</div>
</div></section>
</div></aside>



<h2 class="wp-block-heading"><strong>What’s the problem of styling a HTML5 datalist?</strong></h2>



<p>At the moment of writing, it’s not possible to style a datalist directly.</p>



<p>Hopefully in the future, we will be able to simply use normal CSS like this:</p>



<pre class="wp-block-code"><code>.mr-datalist &gt; * {
    background-color: var(--dark);
    color: var(--light);
}</code></pre>



<p>For now, if you still want to use datalist, there are two ways to do it:</p>



<ul class="wp-block-list">
<li><a href="#the_easiest_way_to_style_a_datalist" data-type="internal" data-id="#the_easiest_way_to_style_a_datalist">An easy way, using a class from a front-end toolkit.</a></li>



<li><a href="#style_a_datalist_with_code">A more manual way, using Vanilla JavaScript.</a></li>
</ul>



<p>The CSS code above will work after implementing any of those 2 options.</p>



<p>Some things that might be important to you:&nbsp;</p>



<ul class="wp-block-list">
<li>These methods might not work on iOS versions prior to the 13th. On those devices, the datalist will not change, working as it does by default.</li>



<li>Both methods should be future-proof. When HTML5 data lists become easier to style, you can remove the front-end toolkit or the JavaScript code. Just keep the classes and the CSS as is.</li>
</ul>



<p>With that aside, let’s move on with this tutorial…</p>



<h2 class="wp-block-heading"><strong>The easiest way to style a datalist</strong></h2>



<p>You can use a front-end toolkit such as <strong><a href="https://marcosrego.com/development/mr-utils/" target="_blank" data-type="post" data-id="473" rel="noreferrer noopener">Mr.Utils</a></strong>.</p>



<p>All you have to do is, make sure you are adding the global JavaScript file <em>js/utils.js</em> in your page (or if you don’t want to load the entire toolkit, you can individually add <em>dev/js/utils/utils_components.js</em>).</p>



<p>After that, you need to add the correct class <strong>.mr-datalist</strong> to your datalist <em>(not to the input)</em> and it will magically transform it into a “search” component.</p>



<p>You can then style it with a <a href="#whats_the_problem_of_styling_a_html5_datalist">CSS code similar to the one shown before</a>.</p>



<h2 class="wp-block-heading"><strong>Style a datalist with code</strong></h2>



<p>I mentioned that the easiest way of implementation works like magic, but of course there’s no magic behind it at all, just the correct JavaScript code.</p>



<p>In this post, I’ll share a simplified version of that code with you.</p>



<p>You can either follow the steps or <strong><a href="#gist_full_code_on_how_to_style_a_datalist">jump directly to the Gist full code</a></strong>.</p>



<p>Feel free to change it to your specific needs.</p>



<h3 class="  wp-block-heading"><strong>1- Transform the datalist into an element that can be styled.</strong></h3>



<pre class="wp-block-code"><code>document.addEventListener("DOMContentLoaded", function () {
  const mrDataLists = document.querySelectorAll(".mr-datalist");
  for (let id = 0; id &lt; mrDataLists.length; id++) {
    let mrDataList = mrDataLists&#91;id];
    let mrDataListUL = "";
    let mrDataListClone = "";
 
    mrDataListClone =
      mrDataList
        .cloneNode(true)
        .innerHTML.replaceAll("&lt;option", "&lt;li")
        .replaceAll("&lt;/option&gt;", "&lt;/li&gt;");
    mrDataListUL = document.createElement("ul");
    mrDataListUL.id = mrDataList.id;
    mrDataListUL.className = mrDataList.className;
    mrDataListUL.innerHTML = mrDataListClone;
 
    mrDataList.replaceWith(mrDataListUL);
  }
}
</code></pre>



<p>In this first step, we grab all data lists that have the class <em>.mr-datalist, </em>but you can change it to your own.</p>



<p>You can even grab all data lists without exception, by replacing the class <em>.mr-datalist</em> with the property <em>datalist, </em>on the <em>querySelectorAll </em>(Don’t forget to change the CSS code accordingly at the end).</p>



<p>In this example, we transform the datalist into an unordered list. You can change that if you wish, but it should be an element with direct children. Each direct child will be a datalist option.</p>



<p>The <em>replaceWith </em>at the end finishes the transformation, but we are not done yet.</p>



<p>We need to create a similar “search” functionality to the one the HTML5 datalist has.</p>



<h3 class="  wp-block-heading"><strong>2- Make the input find content on the element.</strong></h3>



<pre class="wp-block-code"><code>document.addEventListener("keyup", function (e) {
  let mrDataListID = "mr-datalist";
  if (e.target.matches('input&#91;list="'+mrDataListID+'"]')) {
    mrSearch(document.getElementById(mrDataListID), e.target);
  }
  e.stopPropagation();
});
</code></pre>



<p>In here, I’m assuming we know the ID of the datalist, and that we have it on the input “list” attribute. I’m assuming that because those are needed for the original datalist to work.<br>In this example, the ID is <em>mr-datalist,</em> set on the mrDataListID variable.</p>



<p>If for some reason you don’t know the ID, there are alternative ways to do it. On Mr.Utils for example, the “Search” component removes the original input, creates a new one and uses <em>nextElementSibling</em>. It does that for a reason, you can check that on the <a href="https://github.com/marcosrego-web/mr-utils/blob/master/dev/js/utils/utils_components.js" target="_blank" rel="noreferrer noopener nofollow">GitHub repository</a>.</p>



<p>As you might notice, we are calling the function <em>mrSearch</em>, which will do the heavy work.&nbsp;</p>



<p>Here is the function simplified, feel free to rename it to anything you want:</p>



<pre class="wp-block-code"><code>function mrSearch(t, e) {
  //t = Datalist
  //e = Input with list attribute
  let mrSearchChildren = t.children;
  if (mrSearchChildren) {
    if (e.value !== "") {
      t.style.removeProperty("display");
      for (let id = 0; id &lt; mrSearchChildren.length; id++) {
        let mrSearchChild = mrSearchChildren&#91;id];
        if (mrSearchChild.hasAttribute("value")) {
          //If the child does not contain any text, show the value as text.
          if (!mrSearchChild.innerText) {
            mrSearchChild.innerText = mrSearchChild.getAttribute("value");
          }
 
          //Change the input value when clicking on the child.
          mrSearchChild.addEventListener("click", function () {
            e.value = mrSearchChild.getAttribute("value");
          });
        }
        mrSearchChild.style.display = "none";
 
        //Checking the child outerHTML because I want to search text also inside the value attribute. Convert in lowercase to not be case sensitive.
        if (
          mrSearchChild.outerHTML
            .toLowerCase()
            .replace(/&#91;^a-zA-Z0-9 ]/g, "")
            .includes(e.value.toLowerCase().replace(/&#91;^a-zA-Z0-9 ]/g, ""))
        ) {
          mrSearchChild.style.removeProperty("display");
        }
      }
    } else {
      t.style.display = "none";
    }
  }
}

</code></pre>



<p>Here we changed the Input value when clicking on the element child <em>(the datalist option that we transformed)</em> and we’ll make the search case-insensitive.</p>



<p>Check the comments inside the code to better understand which parts replicate which datalist “search” feature.</p>



<p>Extra: If you have full control over the original datalist, you probably added a value and text to each option. If you don’t have, then this code as you covered, it copies the value into the text when no text is found.</p>



<p><strong>And that’s it! </strong>Now you replicated most datalists’ functionalities and can start styling the element, with a <a href="#whats_the_problem_of_styling_a_html5_datalist">CSS code similar to the one shown before</a>.</p>



<h3 class="  wp-block-heading"><strong>3- Take it to the next level (Optional and Advanced)</strong></h3>



<p>If you feel inspired, now that you have full control over the code, you can add extra features! Features that not even the original datalist has.</p>



<p>For example:</p>



<ul class="wp-block-list">
<li>Show a message when no result is found.</li>



<li>Bold the text while it is found on the results.</li>



<li>If no exact match is found, search by each keyword instead <em>(You can also show a message in that situation)</em>.</li>



<li>Show results only after a minimum number of characters <em>(This is a good idea to avoid connection words and code properties)</em>.</li>
</ul>



<p>I did many of those features for <strong>Mr.Utils</strong>, <strong><a href="https://github.com/marcosrego-web/mr-utils/blob/master/dev/js/utils/utils_components.js#L356" target="_blank" rel="noreferrer noopener nofollow">you can check the part of the code here</a></strong>.</p>



<p>Might also be a good idea, to track pressing keyboard arrow keys, to select the results and improve accessibility.</p>



<h3 class="  wp-block-heading"><strong>Gist full code on how to style a datalist</strong></h3>



<script src="https://gist.github.com/marcosrego-web/943e82bbd6243e8f38af4ff5ce081dc6.js"></script>



<h2 class="wp-block-heading"><strong>Working example of styling datalists</strong></h2>



<p>I did something very similar to the methods explained above for <strong><a href="https://www.rydoo.com/compliance/" target="_blank" data-type="URL" data-id="https://www.rydoo.com/compliance/" rel="noreferrer noopener nofollow">Rydoo’s Compliance Centre</a></strong> and <strong><a href="https://www.rydoo.com/marketplace/" data-type="URL" data-id="https://www.rydoo.com/marketplace/" target="_blank" rel="noreferrer noopener nofollow">Marketplace</a></strong>.</p>



<figure class="  wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><a href="https://www.rydoo.com/compliance/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="522" data-id="2727" src="https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Compliance_Centre-1024x522.png" alt="Rydoo-Compliance_Centre" class="wp-image-2727" title="Rydoo Compliance Centre - How to style a datalist and its options?" srcset="https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Compliance_Centre-1024x522.png 1024w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Compliance_Centre-300x153.png 300w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Compliance_Centre-768x391.png 768w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Compliance_Centre-1536x783.png 1536w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Compliance_Centre.png 1902w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Rydoo&#8217;s Compliance Centre</figcaption></figure>



<figure class="     wp-block-image size-large"><a href="https://www.rydoo.com/marketplace/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="522" data-id="2724" src="https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Marketplace-1024x522.png" alt="Rydoo-Marketplace" class="wp-image-2724" title="Rydoo Marketplace - How to style a datalist and its options?" srcset="https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Marketplace-1024x522.png 1024w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Marketplace-300x153.png 300w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Marketplace-768x391.png 768w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Marketplace-1536x783.png 1536w, https://marcosrego.com/wp-content/uploads/2021/08/Rydoo-Marketplace.png 1902w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Rydoo&#8217;s Marketplace</figcaption></figure>
</figure>



<p>I hope you enjoyed this post! I&#8217;m not sure that I will be writing something more on the blog before entering the new year, so enjoy the celebrations and <strong>let&#8217;s enter 2023 with the right footer!!</strong> 🥂🎆🥳</p>



<h2><b>Comments</b></h2>
<div id="disqus_thread"></div>
<script>
if(mrGetCookie('cookielawinfo-checkbox-functional') == 'yes') {
    var disqus_config = function () {
        this.page.url = (location.protocol+'//'+location.host+location.pathname).replace("/account/", "/");
        this.page.identifier = document.querySelector("article").id.replace("post-", "");
    };
    
    (function() {
    var d = document, s = d.createElement('script');
    s.src = 'https://marcosrego-web.disqus.com/embed.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
    })();
} else {
    document.querySelector('#disqus_thread').innerHTML = 'You cannot view or add comments because you did not consent to the use of functional cookies: <a class="  cli_manage_current_consent" style="cursor:pointer;">Manage your consent.</a>';
}
</script>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Mr.Utils</title>
		<link>https://marcosrego.com/development/mr-utils/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Sun, 31 Oct 2021 18:09:00 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[React]]></category>
		<category><![CDATA[Toolkit]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=473</guid>

					<description><![CDATA[A front-end toolkit with a syntax friendly to everyone, that gives you utility classes, custom breakpoints, css variables and javascript functions. Utilities used on Mr.Dev.&#8217;s plugins that you can also use on your own environment. If you are using WordPress you can even install it as a plugin. You&#8217;ll get friendly options on the block [&#8230;]]]></description>
										<content:encoded><![CDATA[<span id="more-473"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/10/mrutils_phone.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/06/mrutils_desktop.mp4" playsinline></video></figure>



<h2 class="wp-block-heading" id="a-front-end-toolkit-with-a-syntax-friendly-to-everyone-that-gives-you-utility-classes-custom-breakpoints-css-variables-and-javascript-functions"><strong>A front-end toolkit with a syntax friendly to everyone, that gives you utility classes, custom breakpoints, css variables and javascript functions.</strong></h2>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-invert-color-color has-link-color-background-color has-text-color has-background wp-element-button" href="https://marcosrego.com/client-area/downloads/?product=mrutils"><strong>Get it now (free)</strong></a></div>



<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://github.com/marcosrego-web/mr-utils/wiki" style="border-radius:6px" target="_blank" rel="noreferrer noopener">See documentation</a></div>
</div>



<h3 class="  wp-block-heading" id="utilities-used-on-mr-dev-s-plugins-that-you-can-also-use-on-your-own-environment"><strong>Utilities used on Mr.Dev.&#8217;s plugins that you can also use on your own environment.</strong></h3>



<p>If you are using WordPress you can even install it as a plugin. You&#8217;ll get <a href="https://marcosrego.com/blog/mr-utils-block-editor-features/" data-type="post" data-id="1997">friendly options on the block editor</a>, which allow you or your clients to use all the features without needing to know the classes or functions.</p>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2021/06/mrutils_desktop.mp4" length="4881295" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2021/10/mrutils_phone.mp4" length="1072336" type="video/mp4" />

			</item>
		<item>
		<title>FlipBook Block</title>
		<link>https://marcosrego.com/development/flipbook-block/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Fri, 20 Aug 2021 00:00:00 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Block editor]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[FlipBook]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[React]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=2905</guid>

					<description><![CDATA[Let your visitors turn the pages! FlipBook Block is a simple yet effective WordPress block that shows a PDF from your Media in a Flip Book.]]></description>
										<content:encoded><![CDATA[<span id="more-2905"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2023/01/flipbook-block_phone.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2023/01/flipbook-block_desktop.mp4" playsinline></video></figure>



<h2 class="wp-block-heading" id="mr-dev-is-your-provider-of-developing-tools"><strong>Let your visitors turn the pages!</strong></h2>



<h3 class="  wp-block-heading" id="he-gives-you-a-powerful-wordpress-widget-to-display-your-content-with-many-customizable-layouts-and-options">FlipBook Block is a simple yet effective WordPress block that shows a PDF from your Media in a Flip Book.</h3>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-invert-color-color has-link-color-background-color has-text-color has-background wp-element-button" href="https://marcosrego.com/client-area/downloads/?product=flipbook-block"><strong>Get it now (free)</strong></a></div>
</div>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2023/01/flipbook-block_phone.mp4" length="1268494" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2023/01/flipbook-block_desktop.mp4" length="231121" type="video/mp4" />

			</item>
		<item>
		<title>Mr.Dev.&#8217;s Widget</title>
		<link>https://marcosrego.com/development/mrdev-widget/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Thu, 19 Aug 2021 23:50:29 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mr.Dev.]]></category>
		<category><![CDATA[Mr.Dev.'s Widget]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=574</guid>

					<description><![CDATA[Mr.Dev. is your provider of developing tools! He gives you a powerful WordPress widget to display your content with many customizable layouts and options.]]></description>
										<content:encoded><![CDATA[<span id="more-574"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/06/mrdevwidget_phone.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/06/mrdevwidget_desktop.mp4" playsinline></video></figure>



<h2 class="wp-block-heading" id="mr-dev-is-your-provider-of-developing-tools"><strong>Mr.Dev. is your provider of developing tools!</strong></h2>



<h3 class="  wp-block-heading" id="he-gives-you-a-powerful-wordpress-widget-to-display-your-content-with-many-customizable-layouts-and-options"><strong>He gives you a powerful WordPress widget to display your content with many customizable layouts and options.</strong></h3>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-invert-color-color has-link-color-background-color has-text-color has-background wp-element-button" href="https://marcosrego.com/client-area/downloads/?product=mrdevs-widget"><strong>Get it now (free)</strong></a></div>



<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://marcosrego.com/mrdev-widget-module-themes/">themes &amp; layouts</a></div>



<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://marcosrego.com/mrdev-widget-module-features/">features</a></div>
</div>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2021/06/mrdevwidget_desktop.mp4" length="1035711" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2021/06/mrdevwidget_phone.mp4" length="8592552" type="video/mp4" />

			</item>
		<item>
		<title>Itemzero</title>
		<link>https://marcosrego.com/websites/itemzero/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Sat, 10 Apr 2021 18:38:50 +0000</pubDate>
				<category><![CDATA[Websites]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[eCommerce]]></category>
		<category><![CDATA[Freelance]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mr.Dev.]]></category>
		<category><![CDATA[Mr.Dev.'s Framework]]></category>
		<category><![CDATA[Mr.Dev.'s Widget]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Store]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=1</guid>

					<description><![CDATA[Portfolio and eCommerce website developed for Itemzero, a design studio specialized in the intersection between technology, information design and editorial design. This project is heavily powered by Mr.Dev. and it&#8217;s the perfect showcase of what is possible to do when combining his framework with his frontend toolkit. The framework allowed the use of the block [&#8230;]]]></description>
										<content:encoded><![CDATA[<span id="more-1"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/06/itemzero-site_mobile.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/06/itemzero-site_desktop.mp4" playsinline></video></figure>



<h2 class="wp-block-heading"><strong>Portfolio and eCommerce website developed for Itemzero, a design studio specialized in the intersection between technology, information design and editorial design.</strong></h2>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://shop.itemzero.com/" target="_blank" rel="noreferrer noopener"><strong>Visit website</strong></a></div>
</div>



<p>This project is heavily powered by Mr.Dev. and it&#8217;s the perfect showcase of what is possible to do when combining <a href="https://marcosrego.com/development/mrdev-framework/" data-type="post" data-id="278">his framework</a> with <a href="https://marcosrego.com/development/mr-utils/" data-type="post" data-id="473">his frontend toolkit</a>.</p>



<p>The framework allowed the use of the block editor on WooCommerce product pages.<br>The frontend toolkit (Mr.Utils) allowed to make specific customizations and to easily use components such as sliders and tabs inside the block editor.</p>



<p>And because this website uses those plugins that I developed, some other plugins that I selected and because I manage this website&#8217;s server + domain, <strong>Itemzero&#8217;s score on Google Pagespeed Insights shows excellent results</strong>.</p>



<figure class="   wp-block-gallery has-nested-images columns-1 is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><a href="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-pagespeed-score_jan-2022.jpg"><img loading="lazy" decoding="async" width="1024" height="485" data-id="2385" src="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-pagespeed-score_jan-2022-1024x485.jpg" alt="itemzero pagespeed score jan-2022" class="wp-image-2385" title="itemzero pagespeed score jan 2022 - Itemzero" srcset="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-pagespeed-score_jan-2022-1024x485.jpg 1024w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-pagespeed-score_jan-2022-300x142.jpg 300w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-pagespeed-score_jan-2022-768x364.jpg 768w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-pagespeed-score_jan-2022-1536x727.jpg 1536w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-pagespeed-score_jan-2022.jpg 1920w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Itemzero&#8217;s product page score on January 2022 according to Google Pagespeed Insights. <a href="https://pagespeed.web.dev/report?url=https%3A%2F%2Fshop.itemzero.com%2Fproducts%2Fthe-book-cover%2F" target="_blank" data-type="URL" data-id="https://pagespeed.web.dev/report?url=https%3A%2F%2Fshop.itemzero.com%2Fproducts%2Fthe-book-cover%2F" rel="noreferrer noopener">Recheck the score</a></figcaption></figure>



<figure class="     wp-block-image size-large"><a href="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-select_toggle.jpg"><img loading="lazy" decoding="async" width="1024" height="577" data-id="1610" src="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-select_toggle-1024x577.jpg" alt="Itemzero product variations uses Mr.Dev.&#039;s Widget" class="wp-image-1610" title="itemzero mrdev widget select toggle - Itemzero" srcset="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-select_toggle-1024x577.jpg 1024w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-select_toggle-300x169.jpg 300w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-select_toggle-768x432.jpg 768w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-select_toggle-1536x865.jpg 1536w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-select_toggle.jpg 1920w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Itemzero&#8217;s product variations for typefaces are presented using Mr.Utils pagination options with the select dropdown as toggle.</figcaption></figure>



<figure class="     wp-block-image size-large"><a href="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-radio_toggle.jpg"><img loading="lazy" decoding="async" width="1024" height="574" data-id="1609" src="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-radio_toggle-1024x574.jpg" alt="Itemzero product testimonials uses Mr.Dev.&#039;s radio buttons as pagination toggle" class="wp-image-1609" title="itemzero mrdev widget radio toggle - Itemzero" srcset="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-radio_toggle-1024x574.jpg 1024w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-radio_toggle-300x168.jpg 300w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-radio_toggle-768x430.jpg 768w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-radio_toggle-1536x861.jpg 1536w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-radio_toggle.jpg 1920w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Itemzero&#8217;s product testimonials uses Mr.Utils radio buttons as pagination toggle.</figcaption></figure>



<figure class="     wp-block-image size-large"><a href="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-tabs.jpg"><img loading="lazy" decoding="async" width="1024" height="572" data-id="1611" src="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-tabs-1024x572.jpg" alt="Itemzero&#039;s shop uses tabs" class="wp-image-1611" title="itemzero mrdev widget tabs - Itemzero" srcset="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-tabs-1024x572.jpg 1024w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-tabs-300x168.jpg 300w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-tabs-768x429.jpg 768w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-tabs-1536x858.jpg 1536w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-tabs.jpg 1920w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Itemzero&#8217;s shop uses tabs from Mr.Utils components.</figcaption></figure>



<figure class="     wp-block-image size-large"><a href="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-woocommerce.jpg"><img loading="lazy" decoding="async" width="1024" height="576" data-id="1607" src="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-woocommerce-1024x576.jpg" alt="Itemzero promotions for the Book Cover using Mr.Dev.&#039;s widget" class="wp-image-1607" title="itemzero mrdev widget woocommerce - Itemzero" srcset="https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-woocommerce-1024x576.jpg 1024w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-woocommerce-300x169.jpg 300w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-woocommerce-768x432.jpg 768w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-woocommerce-1536x864.jpg 1536w, https://marcosrego.com/wp-content/uploads/2021/04/itemzero-mrdev_widget-woocommerce.jpg 1920w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Itemzero&#8217;s Shop uses <a href="https://marcosrego.com/development/mrdev-widget/" data-type="post" data-id="574">Mr.Dev.&#8217;s Widget</a> compatibility with WooCommerce.</figcaption></figure>
</figure>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2021/06/itemzero-site_mobile.mp4" length="5264819" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2021/06/itemzero-site_desktop.mp4" length="5830365" type="video/mp4" />

			</item>
		<item>
		<title>Fazer</title>
		<link>https://marcosrego.com/websites/fazer/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Sat, 10 Apr 2021 18:11:00 +0000</pubDate>
				<category><![CDATA[Websites]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[eCommerce]]></category>
		<category><![CDATA[Freelance]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mr.Dev.]]></category>
		<category><![CDATA[Mr.Dev.'s Framework]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=2940</guid>

					<description><![CDATA[Fazer is a new Portuguese magazine about design, their eCommerce website was designed by Carvalho Bernau and developed by me. The development of this project showcases perfectly the combined power of WordPress&#8216; block editor, with Mr.Dev.&#8217;s Framework, Mr.Dev&#8217;s Theme, Mr.Utils and some custom code. Mr.Dev.&#8217;s Theme is a boilerplate theme, that allowed using all the [&#8230;]]]></description>
										<content:encoded><![CDATA[<span id="more-2940"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/04/fazer_site_phone-1.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/04/fazer_site_desktop-1.mp4" playsinline></video></figure>



<h2 class="wp-block-heading"><strong>Fazer is a new Portuguese magazine about design, their eCommerce website was designed by <a href="http://carvalho-bernau.com/" data-type="URL" data-id="http://carvalho-bernau.com/" target="_blank" rel="noreferrer noopener nofollow">Carvalho Bernau</a> and developed by me.</strong></h2>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://fazer.design/" target="_blank" rel="noreferrer noopener"><strong>Visit website</strong></a></div>
</div>



<p>The development of this project showcases perfectly the combined power of <a href="/account/tag/wordpress/">WordPress</a>&#8216; block editor, with Mr.Dev.&#8217;s Framework, Mr.Dev&#8217;s Theme, Mr.Utils and some custom code.</p>



<p><a href="/account/development/mrdev-framework/#all-framework-features-work-with-any-theme">Mr.Dev.&#8217;s Theme</a> is a boilerplate theme, that allowed using all the features of the block editor on WooCommerce pages (including products and templates), while having the default colors managed from Mr.Dev.&#8217;s Framework.</p>



<p><a href="https://marcosrego.com/development/mr-utils/" data-type="post" data-id="473">Mr.Utils</a> with <a href="https://marcosrego.com/development/mrdev-framework/" data-type="post" data-id="403">Mr.Dev.&#8217;s Framework</a>, added extra style options to the block editor including custom utility classes. That was very handy to define variables to all sizes (font-sizes, padding, margins, etc) and have them editable from one unique place in the backend if needed.</p>



<p>For all the custom code, I used the <a href="/account/development/mrdev-framework/#features">file manager of Mr.Dev.&#8217;s Framework</a> to select where to load each CSS and JS, reducing unused code for each page. This was important for speed purposes. Some PHP custom code was also created. All files can be accessed trough the Framework and edited on the backend, using WordPress&#8217; default plugin files editor.</p>



<p>The custom code was important to reach some specific needs of the design, here are some examples:</p>



<ul class="wp-block-list">
<li>Temporarily have the homepage redirecting to the most recent product/magazine-issue.</li>



<li>Align footnotes with the text, according to the position of the note in the text (on non-mobile breakpoints).</li>



<li>Automatically detect the color of the most recent product and apply it as accent color on the entire site (Products&#8217; colors are added on Mr.Dev.&#8217;s Framework, by having the variable equal to the product slug).</li>



<li>Allow different svg logos for each product (Uses safe SVG).</li>



<li>Enable cache for almost all the pages, regardless of the cart item count. This was made possible by having custom javascript and cookies, to detect the number of items in cart. Also detects which products, to show a &#8220;View the cart&#8221; when a product is already in the cart.</li>



<li>Detect when the scroll passes the header to change the color of the logo, menu, and &#8220;Buy&#8221; buttons from white to the accent color.</li>



<li>Use the alt text of an image, to tell which should be the object-position/background-position for each breakpoint.</li>



<li>Highlight the sub-menus according to the scroll on the page.</li>



<li>Replace default tags taxonomy in favor of authors (multiple authors).</li>



<li>Automatically create categories in Afazeres/Blog matching each WooCommerce product.</li>
</ul>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2021/04/fazer_site_phone-1.mp4" length="5430444" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2021/04/fazer_site_desktop-1.mp4" length="4823172" type="video/mp4" />

			</item>
		<item>
		<title>Atelier Campilho</title>
		<link>https://marcosrego.com/websites/atelier-campilho/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Fri, 09 Apr 2021 06:11:00 +0000</pubDate>
				<category><![CDATA[Websites]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Freelance]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mr.Dev.]]></category>
		<category><![CDATA[Mr.Dev.'s Framework]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=2920</guid>

					<description><![CDATA[Website designed by Carvalho Bernau and developed by me, for the architecture atelier founded by Maria Cristina Campilho. This website was made in WordPress, using plugins and tools developed by me, such as Mr.Dev.&#8217;s Framework. It uses classes and components from Mr.Utils front-end toolkit. Thanks to that and because I manage this website’s server + [&#8230;]]]></description>
										<content:encoded><![CDATA[<span id="more-2920"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/04/atelier-campilho_site_phone.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/04/atelier-campilho_site_desktop.mp4" playsinline></video></figure>



<h2 class="wp-block-heading"><strong>Website designed by <a href="http://carvalho-bernau.com/" data-type="URL" data-id="http://carvalho-bernau.com/" target="_blank" rel="noreferrer noopener nofollow">Carvalho Bernau</a> and developed by me, for the architecture atelier founded by Maria Cristina Campilho.</strong></h2>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://ateliercampilho.pt/" target="_blank" rel="noreferrer noopener"><strong>Visit website</strong></a></div>
</div>



<p>This website was made in WordPress, using plugins and tools developed by me, such as <a href="https://marcosrego.com/development/mrdev-framework/" data-type="post" data-id="403"><strong>Mr.Dev.&#8217;s Framework</strong></a>. It uses <strong>classes and components from <a href="https://marcosrego.com/development/mr-utils/" data-type="post" data-id="473">Mr.Utils front-end toolkit</a></strong>.</p>



<p>Thanks to that and because I manage this website’s server + domain, <strong>Atelier Campilho&#8217;s website score on Google Pagespeed Insights shows excellent results.</strong></p>



<figure class="  wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-7 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><a href="https://marcosrego.com/wp-content/uploads/2021/04/ateliercampilho-page-speed-insights.png"><img loading="lazy" decoding="async" width="1024" height="492" data-id="2929" src="https://marcosrego.com/wp-content/uploads/2021/04/ateliercampilho-page-speed-insights-1024x492.png" alt="Atelier Campilho home page score on April 2023 according to Google Pagespeed Insights." class="wp-image-2929" title="ateliercampilho page speed insights - Atelier Campilho" srcset="https://marcosrego.com/wp-content/uploads/2021/04/ateliercampilho-page-speed-insights-1024x492.png 1024w, https://marcosrego.com/wp-content/uploads/2021/04/ateliercampilho-page-speed-insights-300x144.png 300w, https://marcosrego.com/wp-content/uploads/2021/04/ateliercampilho-page-speed-insights-768x369.png 768w, https://marcosrego.com/wp-content/uploads/2021/04/ateliercampilho-page-speed-insights-1536x739.png 1536w, https://marcosrego.com/wp-content/uploads/2021/04/ateliercampilho-page-speed-insights.png 1959w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Atelier Campilho home page score on April 2023 according to Google Pagespeed Insights. <a href="https://pagespeed.web.dev/report?url=https%3A%2F%2Fateliercampilho.pt%2F" target="_blank" data-type="URL" rel="noreferrer noopener">Recheck the score</a></figcaption></figure>
</figure>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2021/04/atelier-campilho_site_phone.mp4" length="2963884" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2021/04/atelier-campilho_site_desktop.mp4" length="2899377" type="video/mp4" />

			</item>
		<item>
		<title>Ressano Garcia Arquitectos</title>
		<link>https://marcosrego.com/websites/ressanogarcia/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Thu, 08 Apr 2021 23:40:00 +0000</pubDate>
				<category><![CDATA[Websites]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Freelance]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mr.Dev.]]></category>
		<category><![CDATA[Mr.Dev.'s Framework]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=1795</guid>

					<description><![CDATA[Website designed by&#160;Itemzero&#160;and developed by me for an architecture, engaging towards ecologic design. In here you can see a good example of how powerful it can be to combine Mr.Utils with WordPress block editor. For the horizontal scroll/drag/swipe content, the trick was to add the class mr-swipecontent to the respective block&#8217;s advanced options. And also [&#8230;]]]></description>
										<content:encoded><![CDATA[<span id="more-1795"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/09/ressanogarciaarquitectos-site_phone.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2021/09/ressanogarciaarquitectos-site_desktop.mp4" playsinline></video></figure>



<h2 class="wp-block-heading"><strong>Website designed by&nbsp;Itemzero&nbsp;and developed by me for an architecture, engaging towards ecologic design</strong>.</h2>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://ressanogarcia.com/" target="_blank" rel="noreferrer noopener"><strong>Visit website</strong></a></div>
</div>



<p>In here you can see a good example of how powerful it can be to combine <strong><a href="https://marcosrego.com/development/mr-utils/" data-type="post" data-id="473">Mr.Utils</a></strong> with WordPress block editor. For the horizontal scroll/drag/swipe content, the trick was to add the class <strong>mr-swipecontent</strong> to the respective block&#8217;s advanced options.</p>



<p>And also for this website, <a href="https://marcosrego.com/development/mrdev-framework/" data-type="post" data-id="403">Mr.Dev.&#8217;s Framework</a> was used, with the offcanvas option active on mobile and placing reusable blocks (for logo, menu and lang switcher) on website sections <em>(This was prior to the templates option on WP 5.8)</em>.</p>



<p>And because this website uses those plugins that I developed, some other plugins that I selected and because I manage this website’s server + domain,&nbsp;<strong>Ressano Garcia Arquitectos score on Google Pagespeed Insights shows excellent results</strong>.</p>



<figure class="  wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-8 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="     wp-block-image size-large"><a href="https://marcosrego.com/wp-content/uploads/2021/04/ressano-garcia-google-page-speed-insights_jan-2022.jpg"><img loading="lazy" decoding="async" width="1024" height="485" data-id="2395" src="https://marcosrego.com/wp-content/uploads/2021/04/ressano-garcia-google-page-speed-insights_jan-2022-1024x485.jpg" alt="Ressano garcia google page speed insights jan-2022" class="wp-image-2395" title="ressano garcia google page speed insights jan 2022 - Ressano Garcia Arquitectos" srcset="https://marcosrego.com/wp-content/uploads/2021/04/ressano-garcia-google-page-speed-insights_jan-2022-1024x485.jpg 1024w, https://marcosrego.com/wp-content/uploads/2021/04/ressano-garcia-google-page-speed-insights_jan-2022-300x142.jpg 300w, https://marcosrego.com/wp-content/uploads/2021/04/ressano-garcia-google-page-speed-insights_jan-2022-768x364.jpg 768w, https://marcosrego.com/wp-content/uploads/2021/04/ressano-garcia-google-page-speed-insights_jan-2022-1536x728.jpg 1536w, https://marcosrego.com/wp-content/uploads/2021/04/ressano-garcia-google-page-speed-insights_jan-2022.jpg 1920w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Ressano Garcia Arquitectos home page score on January 2022 according to Google Pagespeed Insights. <a href="https://pagespeed.web.dev/report?url=https%3A%2F%2Fressanogarcia.com%2F" target="_blank" data-type="URL" data-id="https://pagespeed.web.dev/report?url=https%3A%2F%2Fressanogarcia.com%2F" rel="noreferrer noopener">Recheck the score</a></figcaption></figure>
</figure>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2021/09/ressanogarciaarquitectos-site_phone.mp4" length="4158695" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2021/09/ressanogarciaarquitectos-site_desktop.mp4" length="5386315" type="video/mp4" />

			</item>
		<item>
		<title>A Junção do Bem</title>
		<link>https://marcosrego.com/websites/ajuncaodobem/</link>
		
		<dc:creator><![CDATA[Marcos Rego]]></dc:creator>
		<pubDate>Sat, 02 Jan 2021 22:42:00 +0000</pubDate>
				<category><![CDATA[Websites]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mr.Dev.]]></category>
		<category><![CDATA[Mr.Dev.'s Framework]]></category>
		<category><![CDATA[Mr.Utils]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://marcosrego.com/?p=2801</guid>

					<description><![CDATA[Website made in partnership with NoMundo for A Junção do Bem Foundation. This WordPress website is powered by Mr.Dev.&#8217;s Framework and Mr.Utils. It uses the Swipe component on the &#8220;Iniciativas&#8221; page and uses pagination options on &#8220;Documentos legais&#8221; page, to create a slide with one item per page.]]></description>
										<content:encoded><![CDATA[<span id="more-2801"></span>
<!--noteaser-->



<figure class=" fixed-video_mobile mr-fadein  wp-block-video fixed-video_mobile mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2022/12/ajuncaodobem_site_phone.mp4" playsinline></video></figure>



<figure class=" fixed-video_desktop mr-fadein  wp-block-video fixed-video_desktop mr-fadein"><video autoplay loop muted preload="none" src="https://marcosrego.com/wp-content/uploads/2022/12/ajuncaodobem_site_desktop.mp4" playsinline></video></figure>



<h2 class="wp-block-heading"><strong>Website made in partnership with <a href="https://nomundo.pt/" data-type="URL" data-id="https://nomundo.pt/" target="_blank" rel="noreferrer noopener nofollow">NoMundo </a>for A Junção do Bem Foundation.</strong></h2>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="   wp-block-button"><a class="wp-block-button__link has-main-background-color-color has-main-text-color-background-color has-text-color has-background wp-element-button" href="https://ajuncaodobem.pt/" target="_blank" rel="noreferrer noopener"><strong>Visit Website</strong></a></div>
</div>



<p>This <a href="https://marcosrego.com/tag/wordpress/" data-type="post_tag" data-id="23">WordPress</a> website is powered by <a href="https://marcosrego.com/development/mrdev-framework/" data-type="post" data-id="403">Mr.Dev.&#8217;s Framework</a> and <a href="https://marcosrego.com/development/mr-utils/" data-type="post" data-id="473">Mr.Utils</a>.</p>



<p>It uses the Swipe component on the &#8220;Iniciativas&#8221; page and uses pagination options on &#8220;Documentos legais&#8221; page, to create a slide with one item per page.</p>
]]></content:encoded>
					
		
		<enclosure url="https://marcosrego.com/wp-content/uploads/2022/12/ajuncaodobem_site_phone.mp4" length="2311573" type="video/mp4" />
<enclosure url="https://marcosrego.com/wp-content/uploads/2022/12/ajuncaodobem_site_desktop.mp4" length="2620252" type="video/mp4" />

			</item>
	</channel>
</rss>
