<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>CSS &#8211; In The Digital</title>
	<atom:link href="https://inthedigital.co.uk/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>https://inthedigital.co.uk</link>
	<description>Web Design, Development and Digital Marketing</description>
	<lastBuildDate>Thu, 21 Apr 2022 22:03:16 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2018/10/cropped-in-the-digital-icon-padded.png?fit=32%2C32&#038;ssl=1</url>
	<title>CSS &#8211; In The Digital</title>
	<link>https://inthedigital.co.uk</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">153467252</site>	<item>
		<title>How to add WP&#8217;s customizer CSS into the classic editor</title>
		<link>https://inthedigital.co.uk/how-to-add-customizer-custom-css-into-wps-classic-editor/</link>
					<comments>https://inthedigital.co.uk/how-to-add-customizer-custom-css-into-wps-classic-editor/#respond</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Sat, 23 Apr 2022 08:25:56 +0000</pubDate>
				<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Custom CSS]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2600</guid>

					<description><![CDATA[Recently, a newly acquired client needed the styling from the Customizer&#8217;s custom CSS to show in the classic editor (TinyMCE). In all my years of working with WordPress, this was the first time I&#8217;d had this request, so, knowing that you can inject styling into the TinyMCE editor, I set about finding a solution. There [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Recently, a newly acquired client needed the styling from the Customizer&#8217;s custom CSS to show in the classic editor (TinyMCE). In all my years of working with WordPress, this was the first time I&#8217;d had this request, so, knowing that you can inject styling into the TinyMCE editor, I set about finding a solution.</p>
<p>There are several ways to add custom styling to the classic editor, including:</p>
<ul>
<li>loading a custom stylesheet, using <code>add_editor_style(&#039;custom-editor-style.css&#039;)</code>,</li>
<li>loading a custom stylesheet, using <code>add_filter(&#039;mce_css&#039;)</code>, and</li>
<li>loading dynamic styles, using <code>add_filter(&#039;tiny_mce_before_init&#039;)</code> and appending style properties to <code>$settings[&#039;content_style&#039;]</code>.</li>
</ul>
<p>In this post, we&#8217;ll focus on the latter, which we can use to get the Customizer&#8217;s CSS.</p>
<h2>Loading Customizer CSS into the Classic Editor</h2>
<p>The Customizer&#8217;s theme CSS is stored in the <code>post</code> table, with post type <code>custom_css</code>. To get this we&#8217;ll use get_posts(), then we&#8217;ll append the <code>post_content</code> to <code>$mce_settings[&#039;content_style&#039;]</code> (after sanitising it). Here&#8217;s the WordPress filter, note that I&#8217;ve used an anonymous function, but you don&#8217;t have to:</p>
<pre><code class="language-php">add_filter(&#039;tiny_mce_before_init&#039;, function ($mce_init) {
    $customizer_posts = get_posts(&#039;post_type=custom_css&amp;numberposts=1&#039;);
    $styles = $customizer_posts[0]-&gt;post_content ?? &#039;&#039;;
    
    // return early if no stlying was found
    if (!$styles) return $mce_init;
    
    // sanitise ready for use
    $styles = sanitize_text_field($styles);
    
    // add styling
    if (isset($mce_init[&#039;content_style&#039;])) {
        $mce_init[&#039;content_style&#039;] .= &quot; $styles &quot;;
    } else {
        $mce_init[&#039;content_style&#039;] = &quot; $styles &quot;;
    }
    
    // return updated settings
    return $mce_init;
});</code></pre>
<p>And that&#8217;s how to add customizer CSS into the classic editor.</p>
<p>If you&#8217;re struggling with this or any other WordPress challenge, don&#8217;t hesitate to get in touch for further support.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/how-to-add-customizer-custom-css-into-wps-classic-editor/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2600</post-id>	</item>
		<item>
		<title>How to reveal the footer from under the content, using position sticky</title>
		<link>https://inthedigital.co.uk/how-to-reveal-a-footer-with-position-sticky/</link>
					<comments>https://inthedigital.co.uk/how-to-reveal-a-footer-with-position-sticky/#respond</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Tue, 19 Apr 2022 07:47:08 +0000</pubDate>
				<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS layout]]></category>
		<category><![CDATA[Custom CSS]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2593</guid>

					<description><![CDATA[<img width="300" height="256" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/04/media-query-hover.jpg?fit=300%2C256&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Detecting mobile devices using CSS media query hover" style="float: none; margin: auto;" decoding="async" fetchpriority="high" />Once upon a time, a challenge like this, where you want to reveal a footer when the end of the content is reached, would have needed position: fixed&#124;absolute and a bit of JavaScript to calculate the dynamic height of the footer, for responsiveness. Thankfully, we now have a much simpler solution, using sticky positioning. With [&#8230;]]]></description>
										<content:encoded><![CDATA[<img width="300" height="256" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/04/media-query-hover.jpg?fit=300%2C256&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Detecting mobile devices using CSS media query hover" style="float: none; margin: auto;" decoding="async" /><p>Once upon a time, a challenge like this, where you want to reveal a footer when the end of the content is reached, would have needed <code>position: fixed|absolute</code> and a bit of JavaScript to calculate the dynamic height of the footer, for responsiveness.</p>
<p>Thankfully, we now have a much simpler solution, using sticky positioning. With <code>position: sticky</code> we don&#8217;t need to worry too much about the height of the footer, we can simply set a sensible minimum viewport size that we&#8217;re confident the footer will fit in and voila, a footer that reveals from underneath the content above it.</p>
<h2>Code example to reveal a footer</h2>
<pre><code class="language-css">@media (min-width: 1200px) and (min-height: 600px) {
    .any-preceding-siblings {
        z-index: 2;
    }
    
    footer {
        position: sticky;
        bottom: 0;
        z-index: 1;
    }
}</code></pre>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/position" target="_blank" rel="noopener nofollow">Sticky positioning</a>, like many styling customisations, is easy when you know what can be achieved with <a href="https://www.w3.org/TR/2018/REC-selectors-3-20181106/" target="_blank" rel="nofollow noopener">CSS3</a> and <a href="https://www.w3.org/TR/selectors-4/" target="_blank" rel="nofollow noopener">CSS4</a>. If you&#8217;re looking for help with custom styling or would like help designing your web pages, please reach out and we&#8217;ll gladly help.</p>
<p>Check out our other CSS tips: <a href="https://inthedigital.co.uk/tag/css/">CSS</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/how-to-reveal-a-footer-with-position-sticky/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2593</post-id>	</item>
		<item>
		<title>How to create a horizontally scrolling section with 2 rows using CSS grid</title>
		<link>https://inthedigital.co.uk/how-to-create-a-horizontally-scrolling-section-with-2-rows-using-css-grid/</link>
					<comments>https://inthedigital.co.uk/how-to-create-a-horizontally-scrolling-section-with-2-rows-using-css-grid/#comments</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Wed, 09 Sep 2020 06:25:10 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Grid]]></category>
		<category><![CDATA[CSS layout]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2174</guid>

					<description><![CDATA[<img width="300" height="300" src="https://i2.wp.com/inthedigital.co.uk/wp-content/uploads/2020/09/Horizontal-scrolling-2-rows-and-infinite-columns-using-CSS-grid.png?fit=300%2C300&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Horizontal scrolling 2 rows and infinite columns using CSS grid | In the Digital" style="float: none; margin: auto;" decoding="async" />Creating horizontal scrolling of multiple rows with display: grid is easy. CSS grid provides powerful layout options to help achieve all sorts of page layouts.]]></description>
										<content:encoded><![CDATA[<img width="300" height="300" src="https://i2.wp.com/inthedigital.co.uk/wp-content/uploads/2020/09/Horizontal-scrolling-2-rows-and-infinite-columns-using-CSS-grid.png?fit=300%2C300&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Horizontal scrolling 2 rows and infinite columns using CSS grid | In the Digital" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-2198" style="max-width: 100%; height: auto;" src="https://inthedigital.co.uk/wp-content/uploads/2020/09/Horizontal-scrolling-2-rows-and-infinite-columns.svg" alt="Horizontal scrolling 2 rows and infinite columns | In The Digital" width="834" height="256" /></p>
<p>This post describes how to create a horizontal grid with 2 rows and infinite columns using CSS grid. This technique uses <code>display: grid</code>, which finally has <a href="https://caniuse.com/css-grid" target="_blank" rel="noopener noreferrer nofollow">decent browser coverage</a>.</p>
<p>Like CSS flex(box), CSS grid is incredibly flexible for creating relatively complex layouts and making seemingly simple ones, well simple (which wasn’t always the case, like centring content both vertically and horizontally).</p>
<h2>Making a grid that scrolls horizontally using CSS grid &amp; grid-auto-flow</h2>
<p>Scrolling up and down is the default way to consume web page content. In order to scroll vertically to consume the content, we can need to tell the browser it&#8217;s okay to overflow on the x-axis and we need to tell the content it doesn&#8217;t need to wrap to the viewport.</p>
<p>There are a few ways to do this, but this post will demonstrate the <code>grid</code> way:</p>
<pre><code class="language-css">.grid.scroll-x {
    display: grid;
    grid-auto-flow: column;
    /* should, in theory, work without overflow-x */
    overflow-x: scroll;
}</code></pre>
<p>As can be seen in the code above, the <code>grid-auto-flow</code> property is the key here. Used in conjunction with <code>display: flex</code>and set to <code>column</code> will tell the browser to render the element&#8217;s children as columns, which is what we want!</p>
<p>In order to reach the solution, this post set out to achieve all that&#8217;s needed now is to spread this grid element&#8217;s children over 2 rows. Fortunately, using <code>grid</code> this is really easy.</p>
<h2>Making a horizontal grid with 2 rows</h2>
<p>The code above will render the horizontal elements, as required. If we introduce another property to this code snippet, <code>grid-template-rows</code>, as per the following code, the element&#8217;s children will now be not only horizontally scrollable but they will also be rendered over 2 rows:</p>
<pre><code class="language-css">.grid.scroll-x--rows-2 {
    display: grid;
    /* auto auto is telling the browser to render two rows, if needed */
    grid-template-rows: auto auto;
    grid-auto-flow: column;
    overflow-x: scroll;
}</code></pre>
<p>This is perfect, just what was needed, and it was achieved with just 3 lines of CSS <code>grid</code> properties (plus <code>overflow-x: scroll</code> you feel the need to include it). <em>However</em>, there&#8217;s one small caveat;  the layout&#8217;s rendered in a reversed &#8216;N&#8217; order, with each column output, then the rows for that column. This outputs the first 2 elements in rows, then adds subsequent elements as columns to the right (as modelled below). This means that if the layout was designed for 2 columns there would need to be at least 3 items to render a second column, but this can be handled with the logic to make sure there are at least 3 items before applying the <code>grid-template-rows</code> property.</p>
<p><img loading="lazy" decoding="async" class="size-medium wp-image-2193 alignnone" style="max-width: 100%; height: auto;" src="https://inthedigital.co.uk/wp-content/uploads/2020/09/Reverse-N.svg" alt="Reverse 'N' Layout of CSS Grid | In The Digital" width="853" height="256" /></p>
<h2>Conclusion</h2>
<p>The <code>display: grid</code> <a href="https://inthedigital.co.uk/tag/css">CSS property</a> is incredibly flexible and I think this scenario demonstrates a great use-case. Yes, this could have been done in other ways, for example, I used negative margins to <a href="https://gameondaily.com/" target="_blank" rel="noopener noreferrer nofollow">create this horizontal masonry layout of cards</a>, but the CSS <code>grid</code> approach feels cleaner and more robust.</p>
<p>If you&#8217;d like to implement something like this in your project, <a href="https://inthedigital.co.uk/contact-us/">please get in touch</a> as we&#8217;re passionate about making the web look great.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/how-to-create-a-horizontally-scrolling-section-with-2-rows-using-css-grid/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2174</post-id>	</item>
		<item>
		<title>Use the hover media query to detect mobile devices</title>
		<link>https://inthedigital.co.uk/detecting-mobile-devices-using-the-css4-hover-media-query/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Mon, 13 Apr 2020 10:30:08 +0000</pubDate>
				<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[Mobile friendly]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS accessibility]]></category>
		<category><![CDATA[CSS magic]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=1962</guid>

					<description><![CDATA[<img width="300" height="256" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/04/media-query-hover.jpg?fit=300%2C256&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Detecting mobile devices using CSS media query hover" style="float: none; margin: auto;" decoding="async" loading="lazy" />Have you needed to apply styling to only touch devices, or only non-touch devices? Well, great news, the hover media query can ease your woes.]]></description>
										<content:encoded><![CDATA[<img width="300" height="256" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/04/media-query-hover.jpg?fit=300%2C256&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Detecting mobile devices using CSS media query hover" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>Have you needed to apply styling to only touch devices, or only non-touch devices? Well, great news CSS4&#8217;s <code>@media (hover: [value])</code> can come to the rescue in a multitude of ways.</p>
<h2>What is CSS4?</h2>
<p>For some time we&#8217;ve been working with CSS3, which I think is pretty epic, especially when compared to <a href="https://www.w3.org/TR/CSS2/" target="_blank" rel="noopener noreferrer nofollow">what came before</a>. And CSS4 goes much further, offering super useful functionality to enhance how we interact with webpages. But, for now, we&#8217;re only focusing on the media query above, that, for me, is a breath of fresh air, as it vastly simplifies scenarios where I only want to target devices that have specific ways of interacting with the. e.g a touch-only device.</p>
<h2>Use-cases for the hover media query</h2>
<p>Here are two use-cases to whet the appetite, hopefully, they&#8217;ll show the power and flexibility of this awesome new media query?!</p>
<h3>Use Case 1: increase spacing between tap targets on touch devices</h3>
<p>I&#8217;ve had this one a few times, where the links are considered too close, thus reporting accessibility issues. The solution is to give each link (tap target) more spacing on touch devices. In this use case, I&#8217;m also using the media query <code>pointer</code> to detect the type of pointer (<code>none|coarse|fine</code>) &#8211; a perfect use-case for the hover media query:</p>
<pre><code class="language-css">@media (hover: none) and (pointer: coarse) {
  .nav-link {
    margin: $nav-link-margin--touch-only;
  }
}</code></pre>
<h3>Use Case 2: hover effects for devices with hover capability</h3>
<p>I was recently building a website where the creative direction required a simple animation that zoomed in on images when hovered over. This featured is intended only for devices that support hover (i.e. mouseover, etc). Here&#8217;s a code snippet that increases the <code>scale</code> of the image element when its parent is in a hovered state :</p>
<pre><code class="language-css">@media (hover: hover) {
  .image-wrap {
    overflow: hidden;

    &gt; img {
      transform: scale(1);
      transition: 0.25s ease-in transform;
    }

    &amp;:hover &gt; img {
      transform: scale(1.15);
      transition: 2.5s ease-out transform;
    }
  }
}</code></pre>
<p>As I&#8217;ve shown in the two use cases, this is a pretty useful media query and one I will be making a lot of use of. I&#8217;m also sure it can be used in conjunction with <a href="https://inthedigital.co.uk/nesting-css-media-queries/">nest media queries</a>? There is, however, one caveat; there is no support for Internet Explorer and Opera Mobile. But I no longer support IE, unless the client explicitly needs it and frankly cannot support the insanely restrictive Opera Mobile browser (unless the client needs it).</p>
<p>So, there it is, the awesome <code>hover</code> media query in CSS4. Enjoy using it!</p>
<h2>Do you have uses for hover media query?</h2>
<p>If you&#8217;ve got another use-case for this query, or you&#8217;d like help implementing it on your sites&#8217; then <a href="https://inthedigital.co.uk/contact-us/">please get in touch</a> as we&#8217;d love to help make use of this great CSS feature.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1962</post-id>	</item>
		<item>
		<title>Inlining CSS &#8211; the Good, the Bad and the Ugly</title>
		<link>https://inthedigital.co.uk/inlining-css-the-good-the-bad-and-the-ugly/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Tue, 26 Nov 2019 15:52:54 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[SEO myths]]></category>
		<category><![CDATA[Website perf]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=1776</guid>

					<description><![CDATA[<img width="300" height="270" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2019/11/good-bad-ugly-e1574784835549.jpeg?fit=300%2C270&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Inlining CSS - the Good, the Bad and the Ugly. In The Digital. good bad ugly e1574784835549" style="float: none; margin: auto;" decoding="async" loading="lazy">I&#8217;m a sucker for performance gains to the point that I&#8217;m convinced I&#8217;m actually losing time overthinking it &#8211; 🤔 A good example is CSS delivery and it&#8217;s always interesting to get others&#8217; opinions on how important they consider styling performance to be and how they measure it. Inlining &#8211; good/bad/ugly? Good I see genuine [&#8230;]]]></description>
										<content:encoded><![CDATA[<img width="300" height="270" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2019/11/good-bad-ugly-e1574784835549.jpeg?fit=300%2C270&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Inlining CSS - the Good, the Bad and the Ugly. In The Digital. good bad ugly e1574784835549" style="float: none; margin: auto;" decoding="async" loading="lazy"><p>I&#8217;m a sucker for performance gains to the point that I&#8217;m convinced I&#8217;m actually losing time overthinking it &#8211; <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f914.png" alt="🤔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>A good example is CSS delivery and it&#8217;s always interesting to get others&#8217; opinions on how important they consider styling performance to be and how they measure it.</p>
<h2>Inlining &#8211; good/bad/ugly?</h2>
<h3>Good</h3>
<p>I see genuine reasons to inline certain styling rules, for use cases such as;</p>
<ul>
<li>a one-off element style</li>
<li>a style that requires browser/JS intervention</li>
<li>overriding nasty <code>!important</code> rules</li>
</ul>
<p><strong>Good use case</strong>: inline background-image</p>
<pre><code>&lt;div class=&quot;card&quot; style=&quot;background-image: url({{ $just_in_time_image_url }})&quot;&gt;[...]&lt;/div&gt;</code></pre>
<p><small>Aside:</small> This isn&#8217;t the best example, as background images should really be responsive;</p>
<pre><code class="lang-php">&lt;style&gt;
  .card {
    background-image: url({{ $just_in_time_image_url }});
  }
  @media (min-width: {{ $breakpoint_width }}) {
    .card {
      background-image: url({{ $just_in_time_image_url }});
    }
  }
&lt;/style&gt;</code></pre>
<p>Beyond these, I&#8217;m all for steering away from it.</p>
<h3>Bad</h3>
<p>IMO, whenever the above doesn&#8217;t apply the rule should be contained in a stylesheet. I see the following used inline, which I would absolutely put in a stylesheet;</p>
<ul>
<li>repeated inline styling spitting out the same rules &#8211; &#8220;Always try to be <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself" rel="nofollow noopener" target="_blank">DRY</a>&#8220;</li>
<li>brand-specific rules &#8211; argh! <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f626.png" alt="😦" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
</ul>
<p><strong>Bad use case</strong>: inline brand colours</p>
<pre><code>&lt;div class=&quot;card&quot; style=&quot;color: #2457ba; background-color: #a0d8c6&quot;&gt;[...]&lt;/div&gt;</code></pre>
<p>Better still, use a preprocessor, such as <a href="https://sass-lang.com/" rel="nofollow noopener" target="_blank">SASS</a>, to reduce maintenance overheads.</p>
<h3>Ugly</h3>
<p>WP plugins. I am amazed at the number of plugins that make excessive use of inlining. My best guesses as to why they do this are;</p>
<ul>
<li>inline rules, well&#8230;rule &#8211; their cascading rank is high (and used in conjunction with <code>!important</code> they are simply brute force bullies)</li>
<li>the plugin&#8217;s styling will not be in the cascading rules of non-plugin elements</li>
<li>to annoy me</li>
</ul>
<p><strong>Ugly use case</strong>: inline rule with <code>!important</code></p>
<pre><code>&lt;div class=&quot;card&quot; style=&quot;opacity: 0.5 !important&quot;&gt;[...]&lt;/div&gt;</code></pre>
<h2>Closing words</h2>
<p>I love building websites and get a lot of satisfaction out of my clients&#8217; sites working hard for them &#8211; both in terms of optimising for search engines and for great user experiences.</p>
<p><strong>A note on SEO</strong>: I&#8217;m not a fan of &#8220;SEO Experts&#8221;, as they are more-often-than-not focusing on one very specific area of SEO; <em>content</em>. Don&#8217;t get me wrong, &#8220;Content <em>is</em> king!&#8221;, but it&#8217;s only part of the puzzle. A good website should;</p>
<ul>
<li>load fast, with optimised assets</li>
<li>look great on mobiles, tablets and desktops, alike</li>
<li>be easy to use and navigate<span class="text-muted">*</span></li>
</ul>
<p><em class="text-muted small">*in hipster terms; provide a good UX design &#8211; aka User Experience</em></p>
<p>When a site is fast, easy to use and has great content (the things actual users are interested in) <em>SEO rankings will naturally improve</em>, as these are the core metric that search engines are concerned with.</p>
<p><strong>Note on low-budget websites</strong>: I&#8217;m not a fan of the crap out there that&#8217;s lowering the standards and the vast number of budget websites that smaller client&#8217;s get lumbered with. This is a false economy, as a good website will work hard and, assuming it&#8217;s built to perform, it will more than pay for itself.</p>
<p>If you&#8217;re looking for a better website, feel free to call for a free consultation with one of the team.</p>
<p><a class="btn btn-primary" href="https://inthedigital.co.uk/contact-us/">Free Consultation</a></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1776</post-id>	</item>
		<item>
		<title>How to break long words using CSS @supports</title>
		<link>https://inthedigital.co.uk/how-to-break-long-words-using-css-supports/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Wed, 07 Nov 2018 09:05:48 +0000</pubDate>
				<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[WP Snippets]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS layout]]></category>
		<category><![CDATA[overflow-wrap]]></category>
		<category><![CDATA[word-wrapping]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=1255</guid>

					<description><![CDATA[<img width="151" height="300" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2018/11/overflowing-text-on-mobile-device.gif?fit=151%2C300&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Overflowing text on mobile device" style="float: none; margin: auto;" decoding="async" loading="lazy" />Recently, I had an odd scenario where wrapping long text needed either word-wrap, overflow-wrap or word-break to achieve the same overflow pattern across different browsers. To arrive at a suitable solution I opted to use @supports to maintain control of the declarations. What is @supports? @supports is a feature query, whose associated block of statments [&#8230;]]]></description>
										<content:encoded><![CDATA[<img width="151" height="300" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2018/11/overflowing-text-on-mobile-device.gif?fit=151%2C300&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Overflowing text on mobile device" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>Recently, I had an odd scenario where wrapping long text needed either <code>word-wrap</code>, <code>overflow-wrap</code> or <code>word-break</code> to achieve the same overflow pattern across different browsers. To arrive at a suitable solution I opted to use <code>@supports</code> to maintain control of the declarations.</p>
<h2>What is @supports?</h2>
<p><code>@supports</code> is a <em>feature query</em>, whose associated block of statments only get triggered when the client (i.e. browser) supports the feature(s), <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@supports" rel="noopener noreferrer nofollow" target="_blank">as described on MDN</a>. Here&#8217;s a simple example:</p>
<pre><code class="lang-css">/*
 * Test if client supports display: grid 
 */
@supports (display: grid) {
  display: grid;
  float: none;
}</code></pre>
<p>The example above is pretty self explanatory:<br />
<em>Process the enclosed block of declarations if the control declaration is know by the client.</em></p>
<h2>The Problem &#8211; text that is too long for the width of its containing box</h2>
<p>This is a common webpage layout hurdle, and one that completely breaks the page if not handled with due consideration. Take for example a scenario I&#8217;ve seen time and again: horizontal scroll on a mobile device, where the content overflowing to the right of the viewport is completly unstyled, as depicted below <em>(NB: the site in the demo isn&#8217;t broken &#8211; we&#8217;re just demostrating the issue)</em>:</p>
<p><a data-toggle="collapse" href="#demoImage">Toggle Demo</a></p>
<figure id="demoImage" class="collapse in text-center">
<img loading="lazy" decoding="async" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2018/11/overflowing-text-on-mobile-device.gif?resize=320%2C634&#038;ssl=1" alt="Overflowing text on mobile device" width="320" height="634" class="alignnone size-full wp-image-1269" data-recalc-dims="1" /><figcaption style="padding:1rem;"><em>The perils of untamed text</em></figcaption></figure>
<h2>Using @supports to handle long words</h2>
<p>This is an ugly problem. And one that&#8217;s often addressed with a combination of <code>hyphens</code>(inc. prefixes) and <code>word-break</code>. Unfortunately, there are times when they don&#8217;t cut it. For example, when a hypen isn&#8217;t a desirable aethestic, or not all words want breaking.</p>
<p>What I was looking for was a way to break long words, but not hypenate them, and defintely don&#8217;t break words that can just fit on the next line. So, through trial and error, I found the following to work perfectly for our use-case, which only passes the relevant declarations to browsers that support them:</p>
<pre><code class="lang-css">/*
 * Break long words
 * Only break words that are too long to fit on one line
 * Uses @supports
 */
h1, h2, h3, h4, article {
  /* doesn&#039;t recognise underscored_words on all browsers */
  word-wrap: break-word; 
}
@supports (overflow-wrap: break-word) and (not (word-break: break-word)) {
  /* doesn&#039;t recognise underscored_words on all browsers, use if word-break: break-word isn&#039;t supported */
  h1, h2, h3, h4, article {
      overflow-wrap: break-word;
  }
}
@supports (word-break: break-word) {
  /* use if supported */
  h1, h2, h3, h4, article {
      word-break: break-word;
  }
}
</code></pre>
<h2>Conclusion</h2>
<p>Using <code>@supports</code> is an elegant way to make us of the tools that fit each of the browsers we need to code for. Sometimes, more-often-than-not, we don&#8217;t need to use it. In the case above I could have just let the browser&#8217;s decide if they could or couldn&#8217;t understand the declarations, but the way I&#8217;ve structured it gives me confidence that I&#8217;ll get the desired outcomes from the declarations I&#8217;ve tested. Plus it gave me a reason to talk about <code>@supports</code>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1255</post-id>	</item>
		<item>
		<title>Nesting CSS Media Queries</title>
		<link>https://inthedigital.co.uk/nesting-css-media-queries/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Sun, 28 Oct 2018 08:47:31 +0000</pubDate>
				<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[WP Snippets]]></category>
		<category><![CDATA[Code snippet]]></category>
		<category><![CDATA[CSS]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=879</guid>

					<description><![CDATA[Processing styling rules based on certain criteria, such as viewport width, is achieved using the @media conditional&#160;group rules.&#160;As of October 2018, all modern browsers support nested @media queries. What&#8217;s a @media query? Here&#8217;s a simple example of a media query to make the text 10% bigger on devices with a screen (viewport) wider than 768px [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Processing styling rules based on certain criteria, such as viewport width, is achieved using the <code>@media</code> conditional&nbsp;group rules.&nbsp;As of October 2018, all modern browsers support <em>nested</em> <code>@media</code> queries.</p>
<h2>What&#8217;s a @media query?</h2>
<p>Here&#8217;s a simple example of a media query to make the text 10% bigger on devices with a screen (viewport) wider than 768px (the viewport width of the original iPad):</p>
<pre><code class="lang-css">@media (min-width: 768px) {
  p, div {
    font-size: 1.1em;
  }
}
</code></pre>
<p>This is a pretty self-explanatory snippet of code:</p>
<blockquote><p>When the width is greater than 768 pixels relatively resize the font size of paragraph and div tags to 110% of their current size.</p></blockquote>
<p>Cool, right? But what about if we also wanted to increase the font-size of&nbsp;<code>div</code> tags by a different amount when the height is greater than 1024px? One solution is to use&nbsp;<strong>nested&nbsp;</strong>media queries.</p>
<h2>What are nested @media queries?</h2>
<p>Taking the problem described above, here&#8217;s an example of nested media queries to make the text within the <code>paragraph</code> and <code>div</code> tags 10% bigger on devices wider than 768px, but with a nested condition to apply an additional rule to <code>div</code> tags when the viewport height is&nbsp;<em>also</em>&nbsp;at least 1024px:</p>
<pre><code class="lang-css">@media (min-width: 768px) {
  p, div {
    font-size: 1.1em;
  }

  @media (min-height: 1024px) {
    div {
      font-size: 1.15em;
    }
  }
}</code></pre>
<p>How about that?! The query is still pretty self-explanatory:</p>
<blockquote><p>When the width is greater than 768 pixels relatively resize the font size of paragraph and div tags to 110% of the current size. However, if the height is greater than 1024 pixels relatively resize the font size of div tags to <em>115%</em> of the current size.</p></blockquote>
<p>Note: there are other ways to achieve this, without nesting the media queries, most obviously is by having separate query groups for <code>paragraph</code> and <code>div</code>&nbsp;tags.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">879</post-id>	</item>
	</channel>
</rss>
