background preloader

HTML5 Custom Data Attributes (data-*)

HTML5 Custom Data Attributes (data-*)
Have you ever found yourself using element class names or rel attributes to store arbitrary snippets of metadata for the sole purpose of making your JavaScript simpler? If you have, then I have some exciting news for you! If you haven't and you're thinking, Wow, that's a great idea! I implore you to rid your mind of that thought immediately and continue reading. Thanks to HTML5, we now have the ability to embed custom data attributes on all HTML elements. These new custom data attributes consist of two parts: Attribute Name The data attribute name must be at least one character long and must be prefixed with 'data-'. Attribute Value The attribute value can be any string. Using this syntax, we can add application data to our markup as shown below: <ul id="vegetable-seeds"> <li data-spacing="10cm" data-sowing-time="March to June">Carrots</li> <li data-spacing="30cm" data-sowing-time="February to March">Celery</li> <li data-spacing="3cm" data-sowing-time="March to September">Radishes</li></ul>

http://html5doctor.com/html5-custom-data-attributes/

Related:  HTML/CSS/Web DesignOutils de développement web

The Best Way to Learn HTML Learning a new skill is often intimidating at first; knowing where to start, who to listen to, what to ignore - it can be a difficult process to get moving. That's what this post is for. It will help you plan out what to learn and in what order, hopefully making what seems like a big hurdle much lower, keeping you interested and encouraging you to carry on learning! Before all Else: Take the Jump This is the most crucial part of any learning process - once you've made the decision to broaden your horizons by learning a new skill you're over the first hurdle! Perhaps you're a designer and looking to move beyond pen, paper and Photoshop, maybe you've previously had nothing to do with the web, it doesn't matter.

Google Analytics Tagging with HTML5 data-* Attributes » Code Nomad Imagine if you will, a page with a significant amount of dynamic page elements. For instance, a slide-out panel containing a number of ‘panes’ containing topical information on various ‘factors’. Let’s assume that once this slide-out is open, we wish the user to be able to jump from factor to factor (similar to a slideshow) using buttons along the bottom of each factor. Let’s go even deeper and say that within each factor, we have a collection of close-up images. Again, the user should be able to navigate the close-ups via next/previous buttons similar to a slideshow. Elements & Semantics - A Beginner's Guide to HTML With a basic understanding of HTML and CSS in hand it is time to dig a little deeper and see what actually assembles these two languages. In order to start building web pages you need to learn a little about which HTML elements are used to display different types of content. You will also want to know how these different elements behave, to help ensure you achieve your desired outcome. Additionally, once you begin writing code you want to make sure that you are doing so semantically. Writing semantic code includes keeping your code organized and making well informed decisions. Semantics Overview

How to Use Media Queries in Responsive Web Design Photo credit: Jeremy Keith, Creative Commons Responsive web design has exploded in popularity — thanks to the need to create sites that work across numerous devices. However, responsive design comes with some problems of its own.

HTML5 This Version: Latest Published Version: Latest Version of HTML: Latest Editor's Draft of HTML: Previous Version: Introduction to HTML Table of Contents Required material In order to complete this tutorial you will need to download the following from below: The zip file includes: Fish3.ogvCanadian_Flag.jpg After you download:

How To Create a Pure CSS Dropdown Menu With the help of some advanced selectors a dropdown menu can be easily created with CSS. Throw in some fancy CSS3 properties and you can create a design that was once only achievable with background images and Javascript. Follow this tutorial to see the step by step process of building your own pure CSS dropdown menu. The menu we will be creating features two sub categories that appear once the parent link is activated by a hover. The first series of sub-links appear underneath main nav bar, then the second series of links fly out horizontally from the first dropdown. Take a look at the CSS dropdown menu demo to see it all in action.

A Basic HTML5 Template For Any Project What follows is an excerpt from HTML5 & CSS3 for the Real World, by Alexis Goldstein, Louis Lazaris and Estelle Weyl. This post was originally published in 2013 and was updated in April 2016. As you learn HTML5 and add new techniques to your toolbox, you’re likely going to want to build yourself boilerplate, from which you can begin all your HTML5-based projects. We encourage this, and you may also consider using one of the many online sources that provide a basic HTML5 starting point for you.[] In this project, however, we want to build our code from scratch and explain each piece as we go along. Of course, it would be impossible for even the most fantastical and unwieldy sample site we could dream up to include every new element or technique, so we’ll also explain some new features that don’t fit into the project.

Introduction to HTML, Basics of HTML and xHTML Markup HTML stands for "HyperText Markup Language". It’s the simple code that’s used to create the structure of web pages and to describe the structure of content on pages. HTML is very easy to learn. However, it’s important to learn and follow best practice. Badly written HTML can exclude users with disabilities, make web sites less accessible to search engines, and mean your site doesn’t work on some browsers. The aim of this section is to teach you simple, basic, good HTML. Responsive Web Design - Learn to Code Advanced HTML Lesson 4 The Internet took off quicker than anyone would have predicted, growing like crazy. Now, for the past few years, mobile growth has exploded onto the scene. The growth of mobile Internet usage is also far out pacing that of general Internet usage growth. These days it is hard to find someone who doesn’t own a mobile device, or multiple, connected to the Internet. In the UK there are more mobile phones than people, and should trends continue mobile Internet usage will surpass that of desktop Internet usage within the year.

Related: