Images, flash, frames. These are the “traditional” methods for making a web site “more interesting” or “better looking.” But these hold-overs from the AOL era are the bane of bandwidth, text-only browsers, and non-visual users.

HTML, of course, was originally written to define the structure of a web page, never it’s design. In essence, HTML was intended to be much like XML today. But, when HTML was created, there were no style-sheets, so HTML was forced to include some design information, like tags and the bgcolor attribute. Developers quickly turned to images, JavaScript, frames, and Flash to make their lives easier, but in the process made everyone else’s life harder.

Images and Flash will both suck bandwidth, so why would you use them to display text or a navigation bar? Save images and Flash for what they’re supposed to be: pictures and animations. Frames reek havoc on text-only browsers and screen-readers (hence the rarely-used tag) and have been considered blase web-design for years.</p> <p>So how can you save bandwidth, insure accessibility, and still get all the effects you want? <abbr title="Cascading Style Sheets.">CSS</abbr>. Let’s go over a few of the quick-and-easy ways to use CSS to replace the bandwidth-heavy, inaccessible design you’re using now:</p> <p><span style="font-weight: bold">1) Frames: Fixed Sidebars</span><br> Perhaps the most common use of frames was the sidebar, a window on the left (or right) that contained anything from helpful information to your site’s navigation, appeared on every page, and didn’t scroll with the rest of the site.</p> <p>If you want to do the same thing, use the CSS “position: fixed” definition. For instance:</p> <h1 id="sidebarpositionfixedtop0left0width160pxheight100background00f">sidebar { position: fixed; top: 0; left: 0; width: 160px; height: 100%; background: #00f; }</h1> <p>This will make a non-scrolling, 160-pixel wide sidebar on the left of the screen. (You could always use “right” and “bottom,” too.) Now, in your HTML file, create a <div> with the <tt>id=&quot;sidebar&quot;</tt> attribute:</p> <div id="sidebar"> ...all your links go here... </div> <p>You can put this anywhere in the HTML source, and it will appear in the correct place. In a good screen-reader, if you put this toward the bottom of the HTML source (for instance, after all the content of the page) then the user would hear the content before having to hear the list of links again.</p> <p><span style="font-weight: bold">2) Images: Positioning Text</span><br> This is really just poor web-design. Unless it’s desperately important that you use a particular, rare font, you should never use images to display text. If it’s important that the text appear a certain way or in a certain position, make use of the box-model and nested <div>s. For example, let’s say you wanted a 480-pixel wide layout, regardless of the users’ screen resolution, with a right gutter and a title and slogan in the top-left. You might do something like:</p> <h1 id="mainwidth480pxheight100margin0autopadding0positionrelativetop0left0gutterwidth120pxheight100margin0padding0borderleft1pxsolid000positionabsolutetop0right0background2c2colorfffheaderwidth360pxmargin0padding6pxpositionrelativetop0left0fontfamilytahomaarialsanseriffontsize140textaligncenter">main { width: 480px; height: 100%; margin: 0 auto; padding: 0; position: relative; top:0; left:0; } #gutter { width: 120px; height: 100%; margin: 0; padding: 0; border-left: 1px solid #000; position: absolute; top: 0; right: 0; background: #2c2; color: #fff; } #header { width: 360px; margin: 0; padding: 6px; position: relative; top: 0; left: 0; font-family: Tahoma, Arial, san-serif; font-size: 140%; text-align: center; }</h1> <p>With the corresponding HTML:</p> <div id="main"> <div id="gutter"> ...gutter code here... </div> <div id="header"> <p>Page Title</p> <p>Page Slogan</p> </div> </div> <p>Which gives something like (borders added to show box model):</p> <p><img src="" alt=""></p> <p>Now, of course, with just a little editing of the CSS file (and none of the HTML) you can move the gutter, change the background, change the page width, change the font, and it’s all in text-format, that will display correctly to text-only or visually-impaired browsers, and save huge percentages of bandwidth.</p> <p><span style="font-weight: bold">3) Flash: Cool Navigation Bars</span><br> This gets a little more complicated. In general, it’s hard to define the box around <a> tags, so you’ll probably want to do something like this:</p> <h1 id="navmargin4pxauto0autopositionrelativetop0left0navuldisplayinlineliststyletypenonenavlidisplayinlineborder1pxsolid000padding2px4px04pxmarginauto4px04pxnavlihereborderbottom1pxsolidfffnavlihoverborderbottom1pxsolidffffontweightbold">nav { margin: 4px auto 0 auto; position: relative; top: 0; left: 0; } #nav ul { display: inline; list-style-type: none; } #nav li { display: inline; border: 1px solid #000; padding: 2px 4px 0 4px; margin: auto 4px 0 4px; } #nav { border-bottom: 1px solid #FFF; } #nav li:HOVER { border-bottom: 1px solid #FFF; font-weight: bold; }</h1> <p>Now in each <li> tag you’ll make a link to the page you want. This particular set of code gives you a horizontal list. I use a version of this on my <a href="" title="Projects page.">projects page</a>, so you can see it in action. If you remove the <tt>display: inline</tt> parts, you’ll get the vertical list you need for a column. Of course, the margin, padding, and all the colors can be customized however you want, to make it look right. (I got this from the <a href="">AListApart</a> article “<a href="">Taming Lists</a>“, which you should read for more information.)</p> <p><span style="font-weight: bold">So there you go…</span><br> It’s not all the info you’ll ever need, but it solves three of the most heinous wastes of bandwidth I’ve seen on the web, as well as all the problems people have with accessibility. These methods can both look great, and be completely usable by everyone, something Flash, frames, and images can’t.</p> </div> </section> <footer class="post-full-footer"> <section class="author-card"> <span class="avatar-wrapper"><svg viewBox="0 0 24 24" xmlns=""><g fill="none" fill-rule="evenodd"><path d="M3.513 18.998C4.749 15.504 8.082 13 12 13s7.251 2.504 8.487 5.998C18.47 21.442 15.417 23 12 23s-6.47-1.558-8.487-4.002zM12 12c2.21 0 4-2.79 4-5s-1.79-4-4-4-4 1.79-4 4 1.79 5 4 5z" fill="#FFF"/></g></svg> </span> <section class="author-card-content"> <h4 class="author-card-name"><a href="/author/jamessocol/">James Socol</a></h4> <p>Read <a href="/author/jamessocol/">more posts</a> by this author.</p> </section> </section> <div class="post-full-footer-right"> <a class="author-card-button" href="/author/jamessocol/">Read More</a> </div> </footer> </article> </div> </main> <aside class="read-next outer"> <div class="inner"> <div class="read-next-feed"> <article class="read-next-card" > <header class="read-next-card-header"> <small class="read-next-card-header-sitetitle">&mdash; Coffee on the Keyboard &mdash;</small> <h3 class="read-next-card-header-title"><a href="/tag/code/">Code</a></h3> </header> <div class="read-next-divider"><svg xmlns="" viewBox="0 0 24 24"><path d="M13 14.5s2 3 5 3 5.5-2.463 5.5-5.5S21 6.5 18 6.5c-5 0-7 11-12 11C2.962 17.5.5 15.037.5 12S3 6.5 6 6.5s4.5 3.5 4.5 3.5"/></svg> </div> <div class="read-next-card-content"> <ul> <li><a href="/open-source-update-waffle-1358/">Open Source Update: Waffle</a></li> <li><a href="/open-source-update-bleach-1359/">Open Source Update: Bleach</a></li> <li><a href="/bounties-and-tips-1204/">Bounties and Tips</a></li> </ul> </div> <footer class="read-next-card-footer"> <a href="/tag/code/">See all 27 posts →</a> </footer> </article> <article class="post-card post tag-design no-image"> <div class="post-card-content"> <a class="post-card-content-link" href="/theres-a-special-place-34/"> <header class="post-card-header"> <span class="post-card-tags">Design</span> <h2 class="post-card-title">There&#x27;s a special place...</h2> </header> <section class="post-card-excerpt"> <p>…in hell for designers and business-types who feel the need to put full-screen advertisements before the website. The same goes to those who put random ads in the way while navigating between two</p> </section> </a> <footer class="post-card-meta"> <ul class="author-list"> <li class="author-list-item"> <div class="author-name-tooltip"> James Socol </div> <a href="/author/jamessocol/" class="static-avatar author-profile-image"><svg viewBox="0 0 24 24" xmlns=""><g fill="none" fill-rule="evenodd"><path d="M3.513 18.998C4.749 15.504 8.082 13 12 13s7.251 2.504 8.487 5.998C18.47 21.442 15.417 23 12 23s-6.47-1.558-8.487-4.002zM12 12c2.21 0 4-2.79 4-5s-1.79-4-4-4-4 1.79-4 4 1.79 5 4 5z" fill="#FFF"/></g></svg> </a> </li> </ul> <span class="reading-time">1 min read</span> </footer> </div> </article> <article class="post-card post tag-travel no-image"> <div class="post-card-content"> <a class="post-card-content-link" href="/home-again-32/"> <header class="post-card-header"> <span class="post-card-tags">Travel</span> <h2 class="post-card-title">Home Again</h2> </header> <section class="post-card-excerpt"> <p>I’ve been back home for over two weeks now. I’m just that good at updating this. A few last words about the Euro-trip: The Iran-Angola game was, as any who watched</p> </section> </a> <footer class="post-card-meta"> <ul class="author-list"> <li class="author-list-item"> <div class="author-name-tooltip"> James Socol </div> <a href="/author/jamessocol/" class="static-avatar author-profile-image"><svg viewBox="0 0 24 24" xmlns=""><g fill="none" fill-rule="evenodd"><path d="M3.513 18.998C4.749 15.504 8.082 13 12 13s7.251 2.504 8.487 5.998C18.47 21.442 15.417 23 12 23s-6.47-1.558-8.487-4.002zM12 12c2.21 0 4-2.79 4-5s-1.79-4-4-4-4 1.79-4 4 1.79 5 4 5z" fill="#FFF"/></g></svg> </a> </li> </ul> <span class="reading-time">2 min read</span> </footer> </div> </article> </div> </div> </aside> <div class="floating-header"> <div class="floating-header-logo"> <a href=""> <span>Coffee on the Keyboard</span> </a> </div> <span class="floating-header-divider">&mdash;</span> <div class="floating-header-title">CSS: Good; Everything Else: Bad</div> <div class="floating-header-share"> <div class="floating-header-share-label">Share this <svg xmlns="" viewBox="0 0 24 24"> <path d="M7.5 15.5V4a1.5 1.5 0 1 1 3 0v4.5h2a1 1 0 0 1 1 1h2a1 1 0 0 1 1 1H18a1.5 1.5 0 0 1 1.5 1.5v3.099c0 .929-.13 1.854-.385 2.748L17.5 23.5h-9c-1.5-2-5.417-8.673-5.417-8.673a1.2 1.2 0 0 1 1.76-1.605L7.5 15.5zm6-6v2m-3-3.5v3.5m6-1v2"/> </svg> </div> <a class="floating-header-share-tw" href=";url=" onclick=", 'share-twitter', 'width=550,height=235');return false;"> <svg xmlns="" viewBox="0 0 32 32"><path d="M30.063 7.313c-.813 1.125-1.75 2.125-2.875 2.938v.75c0 1.563-.188 3.125-.688 4.625a15.088 15.088 0 0 1-2.063 4.438c-.875 1.438-2 2.688-3.25 3.813a15.015 15.015 0 0 1-4.625 2.563c-1.813.688-3.75 1-5.75 1-3.25 0-6.188-.875-8.875-2.625.438.063.875.125 1.375.125 2.688 0 5.063-.875 7.188-2.5-1.25 0-2.375-.375-3.375-1.125s-1.688-1.688-2.063-2.875c.438.063.813.125 0 1-.063 1.5-.25-1.313-.25-2.438-.938-3.313-1.938a5.673 5.673 0 0 1-1.313-3.688v-.063c.813.438 1.688.688 2.625.688a5.228 5.228 0 0 1-1.875-2c-.5-.875-.688-1.813-.688-2.75 0-1.063.25-2.063.75-2.938 1.438 1.75 3.188 3.188 5.25 4.25s4.313 1.688 6.688 1.813a5.579 5.579 0 0 1 1.5-5.438c1.125-1.125 2.5-1.688 4.125-1.688s3.063.625 4.188 1.813a11.48 11.48 0 0 0 3.688-1.375c-.438 1.375-1.313 2.438-2.563 3.188 1.125-.125 2.188-.438 3.313-.875z"/></svg> </a> <a class="floating-header-share-fb" href="" onclick=", 'share-facebook','width=580,height=296');return false;"> <svg xmlns="" viewBox="0 0 32 32"><path d="M19 6h5V0h-5c-3.86 0-7 3.14-7 7v3H8v6h4v16h6V16h5l1-6h-6V7c0-.542.458-1 1-1z"/></svg> </a> </div> <progress id="reading-progress" class="progress" value="0"> <div class="progress-container"> <span class="progress-bar"></span> </div> </progress> </div> <footer class="site-footer outer"> <div class="site-footer-content inner"> <section class="copyright"><a href="">Coffee on the Keyboard</a> &copy; 2019</section> <nav class="site-footer-nav"> <a href="">Latest Posts</a> <a href="" target="_blank" rel="noopener">Twitter</a> <a href="" target="_blank" rel="noopener">Ghost</a> </nav> </div> </footer> </div> <script> var images = document.querySelectorAll('.kg-gallery-image img'); images.forEach(function (image) { var container = image.closest('.kg-gallery-image'); var width = image.attributes.width.value; var height = image.attributes.height.value; var ratio = width / height; = ratio + ' 1 0%'; }) </script> <script src="" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"> </script> <script type="text/javascript" src="/assets/built/jquery.fitvids.js?v=a8b9aa406e"></script> <script src="/assets/built/infinitescroll.js?v=a8b9aa406e"></script> <script> // NOTE: Scroll performance is poor in Safari // - this appears to be due to the events firing much more slowly in Safari. // Dropping the scroll event and using only a raf loop results in smoother // scrolling but continuous processing even when not scrolling $(document).ready(function () { // Start fitVids var $postContent = $(".post-full-content"); $postContent.fitVids(); // End fitVids var progressBar = document.querySelector('#reading-progress'); var header = document.querySelector('.floating-header'); var title = document.querySelector('.post-full-title'); var lastScrollY = window.scrollY; var lastWindowHeight = window.innerHeight; var lastDocumentHeight = $(document).height(); var ticking = false; function onScroll() { lastScrollY = window.scrollY; requestTick(); } function onResize() { lastWindowHeight = window.innerHeight; lastDocumentHeight = $(document).height(); requestTick(); } function requestTick() { if (!ticking) { requestAnimationFrame(update); } ticking = true; } function update() { var trigger = title.getBoundingClientRect().top + window.scrollY; var triggerOffset = title.offsetHeight + 35; var progressMax = lastDocumentHeight - lastWindowHeight; // show/hide floating header if (lastScrollY >= trigger + triggerOffset) { header.classList.add('floating-active'); } else { header.classList.remove('floating-active'); } progressBar.setAttribute('max', progressMax); progressBar.setAttribute('value', lastScrollY); ticking = false; } window.addEventListener('scroll', onScroll, {passive: true}); window.addEventListener('resize', onResize, false); update(); }); </script> </body> </html>