Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML #8

Open
petrosh opened this issue Sep 24, 2015 · 11 comments
Open

HTML #8

petrosh opened this issue Sep 24, 2015 · 11 comments
Labels

Comments

@petrosh
Copy link
Owner

petrosh commented Sep 24, 2015


  • Reload when anchor link: <a href="?reload=1#153">Reload</a> and change reload value.

  1. New Doctype
  2. The Figure Element
  3. No More Types for Scripts and Links
  4. Flexibility with “Quotation marks”
  5. Content Editable
  6. Mark Element
  7. Audio Support
  8. Video Support
  9. Local Storage
  10. [input] Email type
  11. [input] Placeholders Attribute
  12. [input] Required Attribute
  13. [input] Autofocus Attribute
  14. [input] Autofocus Attribute
@petrosh petrosh added the Sass label Sep 24, 2015
@petrosh petrosh changed the title SASS mixins SASS – Mixins Sep 29, 2015
@petrosh
Copy link
Owner Author

petrosh commented Dec 22, 2016

Dialogs

<figure id="dialog-box" class="warning">
    <figcaption>Message Title</figcaption>
    <p>Message text</p>
</figure>

@petrosh petrosh changed the title SASS – Mixins HTML Dec 22, 2016
@petrosh petrosh added HTML and removed Sass labels Dec 22, 2016
@petrosh
Copy link
Owner Author

petrosh commented Dec 22, 2016

Script loading

Links

Use defer

Putting scripts at the end of the body (you can but) strip metadata from the head (where they belong) to the body.

<script src="script.js" defer></script>

@petrosh
Copy link
Owner Author

petrosh commented Jan 8, 2017

Input

Enter file path with forced extension

<input type='text' autocomplete='off' name='$id' pattern='(.*)(\.yml)$'>

Attributes MDN

  • min: The minimum (numeric or date-time) value
  • max: The maximum (numeric or date-time) value
  • step: Limit the increments at which a numeric or date-time value can be set
  • maxlength: Maximum number of characters (in UTF-16 code units)
  • minlength: Minimum number of characters (in Unicode code points)
  • required: User must fill in a value before submitting

form attribute

The id of a <form> element in the same document. This attribute enables you to place elements anywhere within a document, not just as descendants of their form elements.

<form id="form-id">
  ...
</form>
<input type="text" form="form-id">

Select

Default blank option

<option hidden disabled selected value></option>

optgroup

<select>
  <optgroup label="Group 1">
    <option>Option 1.1</option>
  </optgroup> 
  <optgroup label="Group 2">
    <option>Option 2.1</option>
    <option>Option 2.2</option>
  </optgroup>
  <optgroup label="Group 3" disabled>
    <option>Option 3.1</option>
    <option>Option 3.2</option>
    <option>Option 3.3</option>
  </optgroup>
</select>

schermata 2018-02-13 alle 22 16 52

Dates

<input type=date step=7 min=2014-09-08> - Monday only
<input type=time min=9:00 max=17:00 step=900> - 15m increments
<input type=week step=2 min=2014-W30> - odd week

Progress

<progress max="100" value="75">75/100</progress>

schermata 2018-02-13 alle 19 01 36

Meter

<meter min="0" max="100" value="75" low="33" high="66" optimum="50">75</meter>
Value Render
75 schermata 2018-02-13 alle 19 06 42
60 schermata 2018-02-13 alle 19 07 44
30 schermata 2018-02-13 alle 19 08 49

schermata 2018-03-07 alle 13 28 52

@petrosh
Copy link
Owner Author

petrosh commented Jan 12, 2017

Meta tags

<meta charset="utf-8">
<title>What Meta Tags Your Site Should be Using | Aaron Krauss</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimal-ui">
<meta name="description" content="Whenever you’re building a new site, you probably pay...">
 
<!-- Open Graph -->
<meta property="og:title" content="What Meta Tags Your Site Should be Using | Aaron Krauss">
<meta property="og:description" content="Whenever you’re building a new site, you probably pay...">
<meta property="og:image" content="https://thesocietea.org/wp-content/uploads/2016/12/what-meta-tags.jpg">
<meta property="og:url" content="https://thesocietea.org/2016/12/what-meta-tags-your-site-should-be-using/">
<meta property="og:type" content="website">
 
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@thecodeboss">
<meta name="twitter:creator" content="@thecodeboss">

Other example

<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title>Coronavirus country comparator</title>

  <link rel="shortcut icon" href="favicon.ico">

  <link href="css/roboto.css" rel="stylesheet">
  <link href="css/vuetify.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

  <meta property="og:title" content="Coronavirus country comparator" />
  <meta property="og:type" content="website" />
  <meta property="og:url" content="https://boogheta.github.io/coronavirus-countries/" />
  <meta property="og:image" content="https://boogheta.github.io/coronavirus-countries/img/screenshotv2.png"/>
  <meta property="og:description" content="Compare the spread of the COVID-19 coronavirus in all countries by numbers of confirmed, recovered and deceased ones as reported by JHU CSSE and different countries"/>

  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@boogheta">
  <meta name="twitter:creator" content="@boogheta">
  <meta name="twitter:title" content="Coronavirus country comparator">
  <meta name="twitter:description" content="Compare the spread of the COVID-19 coronavirus in all countries by numbers of confirmed, recovered and deceased ones as reported by JHU CSSE and different countries">
  <meta name="twitter:image" content="https://boogheta.github.io/coronavirus-countries/img/screenshotv2.png">
 </head>
 <body>
  <noscript><strong>Coronavirus country comparator requires JavaScript. Please enable it to continue.</strong></noscript>

@petrosh
Copy link
Owner Author

petrosh commented Feb 4, 2017

SVG

External link symbol

<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  <path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#666" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>

Grid

<img src="https://imgh.us/grid.svg" width="641" height="161"/>

Illustrator

Illustrator SVG option panel

SVG FLAGS

@petrosh
Copy link
Owner Author

petrosh commented Feb 8, 2017

Characters encode

hyphen -

minus &minus;

A very close approximation of hyphen but set a little lower and shorter than a true hyphen.

en dash &ndash;

The en dash is a slightly longer dash used to denote ranges or relations.

em dash &mdash;

The em dash is usually one em wide and usually represents a change in thought.

hair space &#8202;

  • This—dash—is normal.
  • This — dash — is hairspaced.
  • This —dash— is spaced.

&mdash; em-dash
&ndash; en-dash
&#8210; figure dash (using en-dash is mostly acceptabe).
&#8209; non-breaking hyphen
&emsp; one em of space
&ensp; one en of space
&nbsp; the much-misused nonbreaking space (use an en space for  &nbsp ktksbai)
&thinsp; thin space (0.2-0.25em)

@petrosh
Copy link
Owner Author

petrosh commented Jun 26, 2017

Redirect

<head>
    <noscript>
        <meta http-equiv="refresh" 
            content="0;URL=https://www.alexkras.com/simple-guide-to-finding-a-javascript-memory-leak-in-node-
            js/amp/" 
        />
    </noscript>
    <title>https://www.alexkras.com/simple-guide-to-finding-a-javascript-memory-leak-in-node-js/amp/</title>
</head>
<script>
    window.opener = null;
    location
    .replace(`https:\/\/www.alexkras.com\/
        simple-guide-to-finding-a-javascript-memory-leak-in-node-js\/amp\/`)
</script>

@petrosh
Copy link
Owner Author

petrosh commented Sep 4, 2017

Responsible Social Share Links

<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fjonsuh.com%2F"
   target="_blank">Share on Facebook</a>

@petrosh
Copy link
Owner Author

petrosh commented Oct 10, 2017

Code

Make <pre> Text Wrap.

pre {
  white-space: pre-wrap;       /* css-3 */
  white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
  white-space: -pre-wrap;      /* Opera 4-6 */
  white-space: -o-pre-wrap;    /* Opera 7 */
  word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

@petrosh
Copy link
Owner Author

petrosh commented Apr 9, 2018

Images

Alternate image onerror

<img src='url.jpg' onerror='this.onerror=null;this.src="other-url.png";'>

@trasparente
Copy link
Collaborator

Sometimes is better:

<input type="text" inputmode="numeric" pattern="[0-9]*">

instead of:

<input type="number">

https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants