Chapter 14: Using HTML with CSS

CSS provides styles to HTML elements on the page. Inline styling involves usage of the style attribute in tags, and is highly discouraged. Internal stylesheets use the <style> tag and are used to declare rules for directed portions of the page. External stylesheets may be used through a <link> tag which takes an external file of CSS and applies the rules to the document. This topic covers usage of all three methods of attachment.

Read More

HTML 5 Notes For Professional – Chapter – 13: Include JavaScript Code in HTML

AttributeDetails
srcSpecifies the path to a JavaScript file. Either a relative or absolute URL.
typeSpecifies the MIME type. This attribute is required in HTML4, but optional in HTML5.
asyncSpecifies that the script shall be executed asynchronously (only for external scripts). This attribute
does not require any value (except of XHTML).
deferSpecifies that the script shall be executed when the page has finished parsing (only for external scripts). This attribute does not require any value (except of XHTML).
chrsetSpecifies the character encoding used in an external script file, e.g. UTF
crossoriginHow the element handles crossorigin requests
nonceCryptographic nonce used in Content Security Policy checks CSP3

Read More

HOW TO CONVERT FORMDATA TO JSON OBJECT

Recently, whilst working on a project I needed to take HTML FormData and then convert it to JSON to be sent off to an API. By default the FormData object does not work in the way you would want it to for JSON.

Using thefor..ofsyntax introduced in ECMAScript 2015, we can access the form data entries and iterate over them to get key and value pairs. This will be the verbose solution, scroll to the bottom to get the cleaner solution using.reducebelow.

Read More

CSS3 – Sticky Header on Scroll Example

In this tutorial I’ve setup an example of how to add an animated sticky header to a website using almost pure CSS with just a touch of javascript.

The header becomes ‘sticky’ when the top header bar is scrolled out of view, in the demo this is 40px but can be changed using the LESS variables at the top of the /content/site.less file.

Read More

Pin It on Pinterest