aboutsummaryrefslogtreecommitdiff
path: root/build/poor-mans-full-bleed/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'build/poor-mans-full-bleed/index.html')
-rw-r--r--build/poor-mans-full-bleed/index.html156
1 files changed, 90 insertions, 66 deletions
diff --git a/build/poor-mans-full-bleed/index.html b/build/poor-mans-full-bleed/index.html
index 7c72e2a..bbd62be 100644
--- a/build/poor-mans-full-bleed/index.html
+++ b/build/poor-mans-full-bleed/index.html
@@ -1,103 +1,127 @@
<!doctype html>
-<html lang="en" id="top">
+<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<title>Poor Man's CSS Full-Bleed Layout</title>
- <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
- <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style>
+ <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
+ <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>
<nav>
- <a href="#menu">Menu &darr;</a>
+ <a href="#menu">Menu &darr;</a>
</nav>
<main>
-<h1>Poor Man's CSS Full-Bleed Layout</h1>
+<h1 id="poor-mans-css-full-bleed-layout">Poor Man&#8217;s CSS Full-Bleed Layout</h1>
+
<p>2020-10-07</p>
-<p>I recently came across the very well written and interesting article, <a href="https://joshwcomeau.com/css/full-bleed/">Full-Bleed Layout Using CSS Grid</a>, while browsing my daily designer feeds. I won't go into the post's specifics here (I recommend you read the article for yourself) but it details how to render full-bleed element effects utilizing the CSS <code>grid</code> property.</p>
-<p>While the approach in the article works perfectly fine, I thought to myself, "Is there not a simpler, more backwards compatible way to do this?". Indeed there is.</p>
-<p><strong>Don't care about the tutorial?</strong> <a href="#live-demo">Skip down to the live demo</a></p>
-<h2>Make the Web Backwards Compatible</h2>
-<p>I try my best when creating specific element designs or layouts to have everything render consistently across almost <em>all</em> browsers. This tends to include the obvious front-runners: Chrome, Firefox, Safari - but I also try my best not to ignore the oldies: IE11, Edge and older versions of Opera. I believe if most web designers even loosely followed this concept we wouldn't be stringing together barely implemented CSS properties and hacking together polyfills for all the unsupported browsers. Just my two cents.</p>
-<p>What does this have to do with full-bleed exactly? Well, the CSS we will be using in this demo is fully compatible with pretty much <em>any browser</em> that can run the basic version of CSS rendering. If the browser you're targeting supports <code>max-width</code> and <code>margins</code> - then have no fear, full-bleeds are here.</p>
-<h2>Our HTML Example</h2>
-<p>Let's create a single-column blog layout for this example. We will include a heading, some paragraphs, an image, and a blockquote to keep it simple:</p>
-<pre><code>&lt;main&gt;
- &lt;article&gt;
- &lt;h1&gt;Main Heading&lt;/h1&gt;
- &lt;p&gt;Et non consequat eiusmod minim fugiat. Magna duis veniam ex reprehenderit occaecat sit. Nisi ut ex aliquip magna enim.&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum repellat ab earum commodi, consequuntur totam adipisci doloremque asperiores quae at quia non temporibus ipsam voluptate voluptatem ipsa nostrum suscipit aliquid!&lt;/p&gt;
- &lt;img src='https://images.unsplash.com/photo-1569083692634-f8db90c093ef?ixlib=rb-1.2.1&amp;q=85&amp;fm=jpg&amp;crop=entropy&amp;cs=srgb&amp;ixid=eyJhcHBfaWQiOjE0NTg5fQ' alt=&quot;Some Image&quot;&gt;
- &lt;p&gt;Ex excepteur Lorem reprehenderit dolore in consequat voluptate commodo ipsum consequat ea et. Nisi tempor proident anim tempor. Laboris est sunt cillum deserunt culpa proident cillum laborum voluptate. Est exercitation Lorem reprehenderit eu ipsum nisi et.&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&lt;/p&gt;
- &lt;blockquote&gt;
- &lt;p&gt;To be, or not to be, that is the question:&lt;br&gt;Whether 'tis nobler in the mind to suffer&lt;br&gt;The slings and arrows of outrageous fortune,&lt;br&gt;Or to take Arms against a Sea of troubles,&lt;br&gt;And by opposing end them: to die, to sleep;&lt;/p&gt;
- &lt;cite&gt;- Some guy&lt;/cite&gt;
- &lt;/blockquote&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&lt;/p&gt;
- &lt;/article&gt;
-&lt;/main&gt;
+
+<p>I recently came across the very well written and interesting article, <a href="https://joshwcomeau.com/css/full-bleed/">Full-Bleed Layout Using CSS Grid</a>, while browsing my daily designer feeds. I won&#8217;t go into the post&#8217;s specifics here (I recommend you read the article for yourself) but it details how to render full-bleed element effects utilizing the CSS <code>grid</code> property.</p>
+
+<p>While the approach in the article works perfectly fine, I thought to myself, &#8220;Is there not a simpler, more backwards compatible way to do this?&#8221;. Indeed there is.</p>
+
+<p><strong>Don&#8217;t care about the tutorial?</strong> <a href="#live-demo">Skip down to the live demo</a></p>
+
+<h2 id="make-the-web-backwards-compatible">Make the Web Backwards Compatible</h2>
+
+<p>I try my best when creating specific element designs or layouts to have everything render consistently across almost <em>all</em> browsers. This tends to include the obvious front-runners: Chrome, Firefox, Safari - but I also try my best not to ignore the oldies: IE11, Edge and older versions of Opera. I believe if most web designers even loosely followed this concept we wouldn&#8217;t be stringing together barely implemented CSS properties and hacking together polyfills for all the unsupported browsers. Just my two cents.</p>
+
+<p>What does this have to do with full-bleed exactly? Well, the CSS we will be using in this demo is fully compatible with pretty much <em>any browser</em> that can run the basic version of CSS rendering. If the browser you&#8217;re targeting supports <code>max-width</code> and <code>margins</code> - then have no fear, full-bleeds are here.</p>
+
+<h2 id="our-html-example">Our HTML Example</h2>
+
+<p>Let&#8217;s create a single-column blog layout for this example. We will include a heading, some paragraphs, an image, and a blockquote to keep it simple:</p>
+
+<pre><code>&#60;main&#62;
+ &#60;article&#62;
+ &#60;h1&#62;Main Heading&#60;&#47;h1&#62;
+ &#60;p&#62;Et non consequat eiusmod minim fugiat. Magna duis veniam ex reprehenderit occaecat sit. Nisi ut ex aliquip magna enim.&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum repellat ab earum commodi, consequuntur totam adipisci doloremque asperiores quae at quia non temporibus ipsam voluptate voluptatem ipsa nostrum suscipit aliquid!&#60;&#47;p&#62;
+ &#60;img src=&#39;https:&#47;&#47;images.unsplash.com&#47;photo-1569083692634-f8db90c093ef?ixlib=rb-1.2.1&#38;q=85&#38;fm=jpg&#38;crop=entropy&#38;cs=srgb&#38;ixid=eyJhcHBfaWQiOjE0NTg5fQ&#39; alt="Some Image"&#62;
+ &#60;p&#62;Ex excepteur Lorem reprehenderit dolore in consequat voluptate commodo ipsum consequat ea et. Nisi tempor proident anim tempor. Laboris est sunt cillum deserunt culpa proident cillum laborum voluptate. Est exercitation Lorem reprehenderit eu ipsum nisi et.&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&#60;&#47;p&#62;
+ &#60;blockquote&#62;
+ &#60;p&#62;To be, or not to be, that is the question:&#60;br&#62;Whether &#39;tis nobler in the mind to suffer&#60;br&#62;The slings and arrows of outrageous fortune,&#60;br&#62;Or to take Arms against a Sea of troubles,&#60;br&#62;And by opposing end them: to die, to sleep;&#60;&#47;p&#62;
+ &#60;cite&#62;- Some guy&#60;&#47;cite&#62;
+ &#60;&#47;blockquote&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&#60;&#47;p&#62;
+ &#60;&#47;article&#62;
+&#60;&#47;main&#62;
</code></pre>
-<p>This works well as it is, but we will need to "section" off our different areas of content based on whether we want them <code>full-bleed</code> or not. We do this with - you guessed it - the <code>section</code> element. In this demo we want the image and blockquote to become <code>full-bleed</code> when rendered, so we'll add the <code>full-bleed</code> class to those sections for now (more on that later):</p>
-<pre><code>&lt;main&gt;
- &lt;article&gt;
- &lt;section&gt;
- &lt;h1&gt;Main Heading&lt;/h1&gt;
- &lt;p&gt;Et non consequat eiusmod minim fugiat. Magna duis veniam ex reprehenderit occaecat sit. Nisi ut ex aliquip magna enim.&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum repellat ab earum commodi, consequuntur totam adipisci doloremque asperiores quae at quia non temporibus ipsam voluptate voluptatem ipsa nostrum suscipit aliquid!&lt;/p&gt;
- &lt;/section&gt;
- &lt;section class=&quot;full-bleed&quot;&gt;
- &lt;img src='https://images.unsplash.com/photo-1569083692634-f8db90c093ef?ixlib=rb-1.2.1&amp;q=85&amp;fm=jpg&amp;crop=entropy&amp;cs=srgb&amp;ixid=eyJhcHBfaWQiOjE0NTg5fQ' alt=&quot;Some Image&quot;&gt;
- &lt;/section&gt;
- &lt;section&gt;
- &lt;p&gt;Ex excepteur Lorem reprehenderit dolore in consequat voluptate commodo ipsum consequat ea et. Nisi tempor proident anim tempor. Laboris est sunt cillum deserunt culpa proident cillum laborum voluptate. Est exercitation Lorem reprehenderit eu ipsum nisi et.&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&lt;/p&gt;
- &lt;/section&gt;
- &lt;section class=&quot;full-bleed&quot;&gt;
- &lt;blockquote&gt;
- &lt;p&gt;To be, or not to be, that is the question:&lt;br&gt;Whether 'tis nobler in the mind to suffer&lt;br&gt;The slings and arrows of outrageous fortune,&lt;br&gt;Or to take Arms against a Sea of troubles,&lt;br&gt;And by opposing end them: to die, to sleep;&lt;/p&gt;
- &lt;cite&gt;- Some guy&lt;/cite&gt;
- &lt;/blockquote&gt;
- &lt;/section&gt;
- &lt;section&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&lt;/p&gt;
- &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&lt;/p&gt;
- &lt;/section&gt;
- &lt;/article&gt;
-&lt;/main&gt;
+
+<p>This works well as it is, but we will need to &#8220;section&#8221; off our different areas of content based on whether we want them <code>full-bleed</code> or not. We do this with - you guessed it - the <code>section</code> element. In this demo we want the image and blockquote to become <code>full-bleed</code> when rendered, so we&#8217;ll add the <code>full-bleed</code> class to those sections for now (more on that later):</p>
+
+<pre><code>&#60;main&#62;
+ &#60;article&#62;
+ &#60;section&#62;
+ &#60;h1&#62;Main Heading&#60;&#47;h1&#62;
+ &#60;p&#62;Et non consequat eiusmod minim fugiat. Magna duis veniam ex reprehenderit occaecat sit. Nisi ut ex aliquip magna enim.&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Laborum repellat ab earum commodi, consequuntur totam adipisci doloremque asperiores quae at quia non temporibus ipsam voluptate voluptatem ipsa nostrum suscipit aliquid!&#60;&#47;p&#62;
+ &#60;&#47;section&#62;
+ &#60;section class="full-bleed"&#62;
+ &#60;img src=&#39;https:&#47;&#47;images.unsplash.com&#47;photo-1569083692634-f8db90c093ef?ixlib=rb-1.2.1&#38;q=85&#38;fm=jpg&#38;crop=entropy&#38;cs=srgb&#38;ixid=eyJhcHBfaWQiOjE0NTg5fQ&#39; alt="Some Image"&#62;
+ &#60;&#47;section&#62;
+ &#60;section&#62;
+ &#60;p&#62;Ex excepteur Lorem reprehenderit dolore in consequat voluptate commodo ipsum consequat ea et. Nisi tempor proident anim tempor. Laboris est sunt cillum deserunt culpa proident cillum laborum voluptate. Est exercitation Lorem reprehenderit eu ipsum nisi et.&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&#60;&#47;p&#62;
+ &#60;&#47;section&#62;
+ &#60;section class="full-bleed"&#62;
+ &#60;blockquote&#62;
+ &#60;p&#62;To be, or not to be, that is the question:&#60;br&#62;Whether &#39;tis nobler in the mind to suffer&#60;br&#62;The slings and arrows of outrageous fortune,&#60;br&#62;Or to take Arms against a Sea of troubles,&#60;br&#62;And by opposing end them: to die, to sleep;&#60;&#47;p&#62;
+ &#60;cite&#62;- Some guy&#60;&#47;cite&#62;
+ &#60;&#47;blockquote&#62;
+ &#60;&#47;section&#62;
+ &#60;section&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus dicta perspiciatis vel ex officiis, nisi optio nihil aspernatur exercitationem sed nobis architecto maxime eaque omnis eos, repellendus necessitatibus provident explicabo?&#60;&#47;p&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid placeat ipsum totam, facere animi tenetur explicabo at veniam, culpa vitae debitis hic modi velit cum perferendis minima quos sit quisquam.&#60;&#47;p&#62;
+ &#60;&#47;section&#62;
+ &#60;&#47;article&#62;
+&#60;&#47;main&#62;
</code></pre>
-<p>That's it for the HTML!</p>
-<h2>The Magic CSS (Not Really)</h2>
+
+<p>That&#8217;s it for the HTML!</p>
+
+<h2 id="the-magic-css-not-really">The Magic CSS (Not Really)</h2>
+
<p>Now take a deep breath and get ready for some hard CSS work:</p>
+
<pre><code>article {
width: 100%;
}
article section {
margin: 0 auto;
- max-width: 480px; /* This can be whatever you want */
+ max-width: 480px; &#47;* This can be whatever you want *&#47;
width: 100%;
}
article section.full-bleed {
max-width: 100%;
}
</code></pre>
-<p>That's it. <em>Really</em>. Now any element (blockquotes, specific headers, navigations, footers, etc) that you want to layout as "full-bleed", just wrap it in a <code>section</code> tag and sick the <code>full-bleed</code> class on it. Done and done.</p>
-<p>Obviously you'll want to add more styling to clean-up and make your full-bleed layouts more beautiful. This demo was just more of a starting point.</p>
-<h3>Maybe Not-Quite-Full-Bleed?</h3>
+
+<p>That&#8217;s it. <em>Really</em>. Now any element (blockquotes, specific headers, navigations, footers, etc) that you want to layout as &#8220;full-bleed&#8221;, just wrap it in a <code>section</code> tag and sick the <code>full-bleed</code> class on it. Done and done.</p>
+
+<p>Obviously you&#8217;ll want to add more styling to clean-up and make your full-bleed layouts more beautiful. This demo was just more of a starting point.</p>
+
+<h3 id="maybe-not-quite-full-bleed">Maybe Not-Quite-Full-Bleed?</h3>
+
<p>You could also further customize your options by including a class like <code>half-bleed</code>, which maybe only expands slightly outside the main section <code>max-width</code>:</p>
+
<pre><code>article section.half-bleed {
max-width: 960px;
}
</code></pre>
-<h3>Sidenote</h3>
+
+<h3 id="sidenote">Sidenote</h3>
+
<p>For those concerned about accessibility: The <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section">section element</a> is a flow content element, so it can contain almost all HTML elements.</p>
-<p><h2 id="live-demo">Live Demo</h2></p>
+
<p><a href="https://codepen.io/bradleytaunt/pen/mdEdjzz">Live CodePen Example</a></p>
<footer role="contentinfo">
<h2>Menu Navigation</h2>