<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>HTML on Lin's Blog</title><link>https://coder.tw/en/tags/html/</link><description>Recent content in HTML on Lin's Blog</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Wed, 26 Apr 2017 09:56:50 +0000</lastBuildDate><atom:link href="https://coder.tw/en/tags/html/index.xml" rel="self" type="application/rss+xml"/><item><title>Forcing a Hyperlink to Download a File in HTML</title><link>https://coder.tw/en/posts/html-force-download-link/</link><pubDate>Wed, 26 Apr 2017 09:56:50 +0000</pubDate><guid>https://coder.tw/en/posts/html-force-download-link/</guid><description>&lt;p&gt;Modern browsers are smart. When a hyperlink points to a plain text file, a PDF, or a CSS file, the browser previews it instead of downloading it. But sometimes we want users to download the file directly instead of viewing it in the browser. For example, when I previously went to the jQuery official site to download jquery.js, it opened as a preview, and I had to right-click and choose &amp;ldquo;Save As.&amp;rdquo; But my goal was clear: I wanted to download the file, not view it!&lt;/p&gt;</description></item><item><title>Fixing HTML Anchor Content Hidden Behind a Menu</title><link>https://coder.tw/en/posts/fix-html-anchor-hidden-by-menu/</link><pubDate>Mon, 20 Feb 2017 23:28:39 +0000</pubDate><guid>https://coder.tw/en/posts/fix-html-anchor-hidden-by-menu/</guid><description>&lt;p&gt;HTML anchors are very handy. When a page is long, an anchor lets visitors jump quickly to a specific section. This technique shows up in many technical documents and blogs. If you&amp;rsquo;ve seen a URL like &lt;a href="https://coder.tw/?p=123#section1"&gt;https://coder.tw/?p=123#section1&lt;/a&gt;, that&amp;rsquo;s the HTML anchor feature at work. Although it&amp;rsquo;s convenient, it brings some problems. The most common one: there is a floating menu at the top of the page. When a visitor clicks an anchor link, the browser does scroll to the section, but part of the text ends up hidden behind the menu. I had always been annoyed by this, and today, while reading Facebook&amp;rsquo;s technical documentation, I found their solution, which is pretty good.&lt;/p&gt;</description></item><item><title>How to Prevent the Input onFocus Event From Firing After Page onFocus</title><link>https://coder.tw/en/posts/how-to-prevent-js-input-onfocus-event-fire-after-page-onfocus/</link><pubDate>Thu, 16 Feb 2017 11:27:59 +0000</pubDate><guid>https://coder.tw/en/posts/how-to-prevent-js-input-onfocus-event-fire-after-page-onfocus/</guid><description>&lt;p&gt;Recently I was working on adding Google Analytics user event tracking code to a website. I attached the code to inputs using HTML event handlers, so that whenever a user clicks a specific field or button, a record is sent to Google Analytics. This works fine, but I noticed a problem. If a user clicks into an input field, switches to another page (another Chrome tab), and then switches back to my page (Page onFocus), the input&amp;rsquo;s onFocus event fires automatically!&lt;/p&gt;</description></item><item><title>Handling File Uploads on the Frontend With JS: Preview, Size, Dimensions, and Format</title><link>https://coder.tw/en/posts/js-file-upload-preview-validation/</link><pubDate>Thu, 09 Feb 2017 13:44:33 +0000</pubDate><guid>https://coder.tw/en/posts/js-file-upload-preview-validation/</guid><description>&lt;p&gt;What I hate most when uploading a file is being told five minutes later that the file is too big or the dimensions are wrong! We usually leave upload validation to the backend, so a file has to be uploaded before we can check whether it meets the requirements. Images in particular also need their aspect ratio checked. If all of this is left entirely to the backend, the user experience can suffer. When I was researching profile picture uploads at NewTalk, I found that all of this can actually be handled on the frontend. With JS and HTML5 APIs, you can check the file&amp;rsquo;s format, size (20MB), and dimensions (100x100). You can even do previews and client-side image cropping and conversion!&lt;/p&gt;</description></item><item><title>JavaScript: Manipulating Browser History, Changing URLs, and the Back Button Event (Essential for SPAs)</title><link>https://coder.tw/en/posts/javascript-manipulate-browser-history/</link><pubDate>Sat, 14 Jan 2017 12:59:02 +0000</pubDate><guid>https://coder.tw/en/posts/javascript-manipulate-browser-history/</guid><description>&lt;p&gt;Nowadays JavaScript is everywhere. Using JS to manipulate web pages, for things like Ajax, page switching, and pop-up windows, is more and more common. There are even JS frameworks such as React JS and Vue JS that help you develop Single Page Applications (SPAs). When you manipulate a web page with JS, the thing you fear most is URL changes and history. For example, if you switch pages with jQuery, the URL doesn&amp;rsquo;t change, because it&amp;rsquo;s a JS operation. And when the user clicks the browser&amp;rsquo;s Back button in the top left corner, they go straight to another page, because JS operations aren&amp;rsquo;t recorded in the history (in fact, they can&amp;rsquo;t be). To solve this series of problems, you can use history.pushState, history.replaceState, and the onpopstate event provided by HTML5.&lt;/p&gt;</description></item><item><title>Zen Coding: A Great Tool for Speedy Web Development, a Must-Have for Anyone Who Likes Hand-Writing Web Pages～</title><link>https://coder.tw/en/posts/zen-coding-fast-web-development/</link><pubDate>Mon, 22 Aug 2011 21:40:44 +0000</pubDate><guid>https://coder.tw/en/posts/zen-coding-fast-web-development/</guid><description>&lt;p&gt;I think many people are like me: when building a web page, they don&amp;rsquo;t like dragging out the layout directly in DW, and instead prefer to open Notepad and write the HTML by hand～ The upside of this approach is that it sharpens your skills XD, but the downside is that development is a bit slow (actually, once you get used to working this way, you&amp;rsquo;re faster than you would be with DW&amp;hellip; XD). Today I want to introduce Zen Coding to you — it can make you write web pages N times faster! You can write web pages directly using CSS-style syntax～&lt;/p&gt;</description></item><item><title>W3C Validation: Checking Whether Your Site's CSS Meets the Standards</title><link>https://coder.tw/en/posts/w3c-css-validation/</link><pubDate>Sun, 06 Sep 2009 13:36:56 +0000</pubDate><guid>https://coder.tw/en/posts/w3c-css-validation/</guid><description>&lt;p&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2009/09/2009-09-06-000.jpg"&gt;&lt;img class="alignnone size-full wp-image-1873" title="2009-09-06 000" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2009/09/2009-09-06-000.jpg" alt="2009-09-06 000" width="405" height="84" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;About the W3C:&lt;/h2&gt;
The W3C is an organization dedicated to standardizing the web. It is responsible for drafting all kinds of web-related specifications. For example, the CSS4 standard and XHTML were both created by the W3C. Why create these standards? The reason is simple. Web pages are displayed in different browsers. If every browser used different syntax, web designers would have a hard time. But getting all browser vendors to agree on one standard is difficult. I think the main reason is that they're all competing with each other. That's why the W3C was created: an impartial third party drafts the standards, and each browser vendor (such as IE, Opera, and Firefox) must follow these basic rules. Of course, browsers can add their own syntax if they want. Still, not every browser follows the W3C specifications. Big names like IE don't, which is why many web designers have a love-hate relationship with IE (love, because so many people use it; hate, because it doesn't play by the rules). Now that you have a basic understanding of the W3C, let me show you how to check whether a web page meets the standards.</description></item></channel></rss>