Tag/Attribute | Value |
<img> | Below are the image map-specific attributes to use with <img>. Regular <img> attributes apply. |
usemap | The name of the map with a hash symbol prepended to it. For example, for a map with name=“map”, the image should have usemap=“#map”. |
<map> | |
name | The name of the map to identify it. To be used with the image’s usemap attribute. |
<area> | Below are <area>-specific attributes. When href is specified, making the <area> a link, <area> also supports all of the attributes of the anchor tag (<a>) except ping. See them at the MDN docs. |
alt | The alternate text to display if images are not supported. This is only necessary if href is also set on the <area>. |
coords | The coordinates outlining the selectable area. When shape=“polygon”, this should be set to a list of “x, y” pairs separated by commas (i.e., shape=“polygon” coords=“x1, y1, x2, y2, x3, y3, …”). When shape=”rectangle”, this should be set to left, top, right, bottom. When shape=“circle”, this should be set to centerX, centerY, radius. |
href | The URL of the hyperlink, if specified. If it is omitted, then the <area> will not represent a hyperlink. |
shape | The shape of the <area>. Can be set to default to select the entire image (no coords attribute necessary), circle or circ for a circle, rectangle or rect for a rectangle, and polygon or poly for a polygonal area specified by corner points. |
Chapter 15: Images
Parameters | Details |
src | Specifies the URL of the image |
srcset | Images to use in different situations (e.g., high-resolution displays, small monitors, etc) |
sizes | Image sizes between breakpoints |
crossorigin | How the element handles crossorigin requests |
usemap | Name of image map to use |
ismap | Whether the image is a server-side image map |
alt | Alternative text that should be displayed if for some reason the image could not be displayed |
width | Specifies the width of the image (optional) |
height | Specifies the height of the image (optional) |
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.
HTML 5 Notes For Professional – Chapter – 13: Include JavaScript Code in HTML
Attribute | Details |
---|---|
src | Specifies the path to a JavaScript file. Either a relative or absolute URL. |
type | Specifies the MIME type. This attribute is required in HTML4, but optional in HTML5. |
async | Specifies that the script shall be executed asynchronously (only for external scripts). This attribute does not require any value (except of XHTML). |
defer | Specifies 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). |
chrset | Specifies the character encoding used in an external script file, e.g. UTF |
crossorigin | How the element handles crossorigin requests |
nonce | Cryptographic nonce used in Content Security Policy checks CSP3 |
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 the for..of
syntax 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 .reduce
below.
BULK LINUX CHMOD COMMANDS FOR FILES & DIRECTORIES
Recently in Ubuntu which I use for my hosting operating system of choice I needed to bulk change permissions on a bunch of folders and files. I needed to set permissions on folders within a WordPress installation to 755 and all files in theme, plugin and asset directories to 644.
Posts Permalink: Force Rewrite WordPress URLs to Use /blog/ in Posts Permalink Structure
This tutorial will show you ways to force rewrite WordPress URLs to use /blog/ in posts permalink structure. Websites that have an outsized number of pages, custom post types, posts, and posts categories may benefit by using the prefix “blog” within the URL rather than the blog category name slug. Most importantly, blogs that have posts in multiple categories, or categories that get removed or changed, should use this type of URL structure.
How to prevent SQL injection in PHP
Use prepared statements and parameterized queries. These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an attacker to inject malicious SQL.
HTML 5 Notes For Professional – Chapter – 12 (Linking Resources)
Attribute | Details |
charset | Specifies the character encoding of the linked document |
crossorigin | Specifies how the element handles cross origin requests |
href | Specifies the location of the linked document |
hreflang | Specifies the language of the text in the linked document |
media | Specifies on what device the linked document will be displayed, often used with selecting stylesheets based on the device in question |
rel | Required. Specifies the relationship between the current document and the linked document |
rev | Specifies the relationship between the linked document and the current document |
sizes | Specifies the size of the linked resource. Only when rel="icon" |
target | Specifies where the linked document is to be loaded |
type | Specifies the media type of the linked document |
integrity | Specifies a base64 encoded hash (sha256, sha384, or sha512) of the linked resource allowing the browser to verify its legitimacy. |
While many scripts, icons, and stylesheets can be written straight into HTML markup, it is best practice and more efficient to include these resources in their own file and link them to your document. This topic covers linking external resources such as stylesheets and scripts into an HTML document.