aboutsummaryrefslogtreecommitdiff
path: root/build/notice
diff options
context:
space:
mode:
authorBradley Taunt <bt@btxx.org>2024-07-02 14:22:21 -0400
committerBradley Taunt <bt@btxx.org>2024-07-02 14:22:21 -0400
commit3f6a9546ec13063d0d5bdf21d30a93d3e8aa6050 (patch)
tree947985c4eda1bceb1910bc01739c32fd0baad181 /build/notice
parent14074019d62d98885c4c764401a9e7e1fd129f79 (diff)
Rebuild changes based off latest barfHEADmaster
Diffstat (limited to 'build/notice')
-rw-r--r--build/notice/index.html105
1 files changed, 105 insertions, 0 deletions
diff --git a/build/notice/index.html b/build/notice/index.html
new file mode 100644
index 0000000..9cd5d4e
--- /dev/null
+++ b/build/notice/index.html
@@ -0,0 +1,105 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark light">
+ <link rel="icon" href="data:,">
+ <title>RE: Creating a Simple HTML/CSS Notice Box</title>
+ <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;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}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>
+</nav>
+
+<main>
+<h1 id="re-creating-a-simple-htmlcss-notice-box">RE: Creating a Simple HTML&#47;CSS Notice Box</h1>
+<p>2022-09-22</p>
+<p>I recently read Kev Quirk&#8217;s post, <a href="https://kevquirk.com/how-to-create-a-simple-html-css-notice-box/">How to Create a Simple HTML&#47;CSS Notice Box</a> and loved the simplicity of it. I&#8217;m a sucker for using pseudo elements in creative ways but still managing to make them useful. Of course, this got me thinking as to whether or not the same style of box could be achieved <em>without</em> the use of static, pseudo elements&#8230;</p>
+<h2 id="bad-semantics">Bad Semantics</h2>
+<p>I need to make it clear right away: <strong>these implementations are not semantic</strong>. They are valid HTML, but I am technically using these tags incorrectly. <em>You have been warned!</em></p>
+<h2 id="setting-fieldsets">Setting Fieldsets</h2>
+<p>The first approach is to wrap everything inside HTML <code>fieldset</code> tags:</p>
+<pre><code>&#60;fieldset&#62;
+ &#60;legend&#62;Notice&#60;&#47;legend&#62;
+ &#60;p&#62;Lorem ipsum, dolor sit amet consectetur adipisicing elit. Totam nihil velit vitae sed beatae earum assumenda deleniti, inventore repellendus, sequi distinctio delectus porro explicabo quidem hic quo quasi voluptas temporibus.&#60;&#47;p&#62;
+&#60;&#47;fieldset&#62;
+</code></pre>
+<p>Then you can include minor styling to closely match the design of Kev&#8217;s notice box:</p>
+<pre><code>fieldset {
+ border: 3px solid;
+ font-family: sans-serif;
+ padding: 30px 10px 10px;
+ position: relative;
+}
+fieldset legend {
+ background: #AACCFF;
+ border-bottom: 3px solid;
+ border-right: 3px solid;
+ left: 0;
+ margin: 0;
+ padding: 5px 10px;
+ position: absolute;
+ top: 0;
+ text-transform: uppercase;
+}
+</code></pre>
+<h2 id="the-devil-is-in-the-details">The Devil is in the Details</h2>
+<p>The other option is utilizing the HTML <code>details</code> tag:</p>
+<pre><code>&#60;details open&#62;
+ &#60;summary&#62;Notice&#60;&#47;summary&#62;
+ &#60;p&#62;Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda sequi esse reprehenderit facilis aperiam labore optio minus doloremque nesciunt! Voluptatem esse tempore asperiores recusandae rerum facere, reiciendis officia repudiandae similique?&#60;&#47;p&#62;
+&#60;&#47;details&#62;
+</code></pre>
+<p>You&#8217;ll obviously want to include the <code>open</code> attribute to avoid users needing to toggle the content manually (unless that is your desired UX). Then add similar styling options to match the <code>fieldset</code> example:</p>
+<pre><code>details {
+ border: 3px solid;
+ font-family: sans-serif;
+ padding: 0 10px 10px;
+}
+details summary {
+ background: #AACCFF;
+ border-bottom: 3px solid;
+ border-right: 3px solid;
+ display: inline-block;
+ margin-left: -10px;
+ padding: 5px 10px;
+ text-transform: uppercase;
+}
+</code></pre>
+<p>Important to note: you can hide the default &#8220;arrow toggle&#8221; on <code>summary</code> elements by including the following:</p>
+<pre><code>details &#62; summary {
+list-style: none;
+}
+details &#62; summary::-webkit-details-marker {
+display: none;
+}
+</code></pre>
+<h2 id="seeing-is-believing">Seeing is Believing</h2>
+<p>I&#8217;ve put together two versions of each implementation (one custom designed and one using default browser styling). You can check them out in the CodePen below:</p>
+<p><a href="https://codepen.io/bradleytaunt/pen/jOxLdQP">Live CodePen Example</a></p>
+<footer role="contentinfo">
+ <h2>Menu Navigation</h2>
+ <ul id="menu">
+ <li><a href="/">Home</a></li>
+ <li><a href="/projects">Projects</a></li>
+ <li><a href="/uses">Uses</a></li>
+ <li><a href="/wiki">Wiki</a></li>
+ <li><a href="/resume">Resume</a></li>
+ <li><a href="/colophon">Colophon</a></li>
+ <li><a href="/now">Now</a></li>
+ <li><a href="/donate">Donate</a></li>
+ <li><a href="/atom.xml">RSS</a></li>
+ <li><a href="#top">&uarr; Top of the page</a></li>
+ </ul>
+ <small>
+ Built with <a href="https://barf.btxx.org">barf</a>. <br>
+ Feeds: <a href="/atom.xml">Atom</a> & <a href="/rss.xml">RSS</a><br>
+ Maintained with ♥ for the web. <br>
+ Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
+ The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
+ </small>
+</footer> \ No newline at end of file