\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Phil35} \pdfinfo{ /Title (html-anti-seche-2018.pdf) /Creator (Cheatography) /Author (Phil35) /Subject (HTML Anti-sèche 2018 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{D60F09} \definecolor{LightBackground}{HTML}{FCF0EF} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{HTML Anti-sèche 2018 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Phil35} via \textcolor{DarkBackground}{\uline{cheatography.com/53795/cs/14486/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Phil35 \\ \uline{cheatography.com/phil35} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 5th February, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{html file structure}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textless{}!DOCTYPE html\textgreater{} \newline \textless{}html lang="fr"\textgreater{} \newline \newline \textless{}head\textgreater{} \newline \textless{}meta charset="utf-8"\textgreater{} \newline \textless{}title\textgreater{} Zeus18 \textless{}/title\textgreater{} \newline \textless{}link rel="icon" type="image/png" href="img/favicon.png" /\textgreater{} \newline \textless{}link rel="stylesheet" type="text/css" href="./normalize.css"\textgreater{} \newline \textless{}style type="text/css"\textgreater{} \newline ... css code ... \newline \textless{}/style\textgreater{} \newline \textless{}/head\textgreater{} \newline \textless{}body\textgreater{} \newline \textless{}div id="login-window"\textgreater{} \newline ... html code ... \newline \textless{}/div\textgreater{} \newline \textless{}script src="./zepto.min.js"\textgreater{} \textless{}/script\textgreater{} \newline \textless{}script language="JavaScript"\textgreater{} \newline ... javascript code ... \newline \textless{}/script\textgreater{} \newline \textless{}/body\textgreater{} \newline \textless{}/html\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Afin d'accélérer l'affichage de la page, il est préférable de télécharger les séquences javascript en fin de body.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.12 cm} x{4.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Balises sémantiques}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{html5 conseille de remplacer des balises \textless{}div\textgreater{} par des balises ayant une signification sémantique} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \textless{}h1\textgreater{} \textless{}h2\textgreater{}... & balises de titres (connues depuis longtems!) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\textless{}section\textgreater{}} \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} \textless{}article\textgreater{} & au sens article principal de la page, ou liste d'articles. \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} \textless{}header\textgreater{}\{\{nl\}\}\textless{}footer\textgreater{} & de l'article, ou de la page du site \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \textless{}nav\textgreater{} & bloc de liens de navigation \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \textless{}aside\textgreater{} & pub, les suggestions d'autres articles, les photos et encadrés de l'article \tn % Row Count 16 (+ 4) % Row 7 \SetRowColor{white} \textless{}figure\textgreater{}\{\{nl\}\}\textless{}figcaption\textgreater{} & associer une légende à une illustration ou un autre élément média \tn % Row Count 19 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{un explicatif avec organigramme : \newline http://html5doctor.com/lets-talk-about-semantics/} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Exemple de balise sémantique \textless{}article\textgreater{} (copy)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textless{}article\textgreater{} \newline ... \newline \textless{}footer\textgreater{} \newline \textless{}p\textgreater{}Posté par Simon, le \newline \textless{}time datetime="2012-02-02"\textgreater{}2 février 2012\textless{}/time\textgreater{} \newline \textless{}/p\textgreater{} \newline \textless{}/footer\textgreater{} \newline \textless{}/article\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{images}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textless{}img src="img/pic.jpg" width="80\%" height="60\%" alt="trombinoscope" /\textgreater{} \newline \textless{}!-{}- c'est mieux de préciser la taille de l'image -{}-\textgreater{} \newline \textless{}!-{}- le \% fait référence au bloc en cours, non à la taille initiale de l'image -{}-\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.08 cm} x{5.92 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{links}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{`\textless{}a href="fichier" target="valeur"\textgreater{}le lien\textless{}/a\textgreater{}`} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{{\bf{target}} peut prendre les valeurs suivantes :} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \_parent & L'URL cible va s'afficher dans la structure externe de la frame en cours \tn % Row Count 5 (+ 3) % Row 3 \SetRowColor{white} \_self & L'URL cible va s'afficher dans la même frame que le lien (fenêtre si vous n'avez pas de frame car une fenêtre est une frame unique \tn % Row Count 10 (+ 5) % Row 4 \SetRowColor{LightBackground} \_blank or \_new & L'URL cible va s'afficher dans une nouvelle fenêtre ouverte automatiquement par le navigateur \tn % Row Count 14 (+ 4) % Row 5 \SetRowColor{white} \_top & 'URL cible va s'afficher dans l'intégralité de la fenêtre du navigateur en cours et les frames (s'il y en a) disparaissent \tn % Row Count 19 (+ 5) % Row 6 \SetRowColor{LightBackground} "toto" & L'URL cible va s'afficher dans la frame portant l'attribut name="toto" \tn % Row Count 22 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{{\bf{href}} peut prendre les valeurs suivantes :} \tn % Row Count 23 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{`"mailto:hello@example.com"`\{\{nl\}\}ouverture du client mail local, en espérant qu'il existe.} \tn % Row Count 25 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{` "page.php"` ou `"page.pl"`, etc.\{\{nl\}\}url locale au serveur} \tn % Row Count 27 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{` \seqsplit{"http://domaine.tld/path/"`} \{\{nl\}\}url externe au site} \tn % Row Count 29 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Exemple de formulaire}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textless{}form action="mapage.php" method="post" \newline enctype="text/plain" \newline name="formulaireTest" id="formulaireTest" \newline onsubmit="return validateFormOnSubmit(this)"\textgreater{} \newline \textless{}fieldset\textgreater{} \newline \textless{}legend\textgreater{}Veuillez décrire votre identité\textless{}/legend\textgreater{} \newline \textless{}li\textgreater{} \newline \textless{}label for="nom"\textgreater{}Nom\textless{}/label\textgreater{} \newline \textless{}input id="nom" name="nom" type="text" placeholder="Nom"\textgreater{} \newline \textless{}/li\textgreater{} \newline \textless{}li\textgreater{} \newline \textless{}label for="prenom"\textgreater{}Prénom\textless{}/label\textgreater{} \newline \textless{}input id="prenom" name="prenom" type="text" required\textgreater{} \newline \textless{}/li\textgreater{} \newline \textless{}li\textgreater{} \newline \textless{}label for="email"\textgreater{}Email\textless{}/label\textgreater{} \newline \textless{}input id="email" name="email" type="email" \newline \seqsplit{placeholder="exemple@domaine}.com"\textgreater{} \newline \textless{}/li\textgreater{} \newline \textless{}/fieldset\textgreater{} \newline \textless{}/form\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Image Formulaire}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/phil35_1516984523_formulaire.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.6 cm} x{6.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{input}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Les balises input sont de 3 types} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{text} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} radio & choix 1 parmi n (tous de même `name=`) \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{password} & affichage caché \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{checkbox} & plusieurs parmis n \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{select} \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{submit} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} button & button permet de définir l'url d'envoi au niveau button, au lieu de \textless{}form\textgreater{} et donc d'avoir plussieurs boutons avec des url différentes si nécessaire. \tn % Row Count 13 (+ 5) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{reset} \tn % Row Count 14 (+ 1) % Row 9 \SetRowColor{white} output & peut être utilisé pour afficher un résultat \tn % Row Count 16 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Les balises text peuvent être spécialisées\{\{nl\}\}Cela permet au browser mobile de proposer un clavier plus adapté} \tn % Row Count 19 (+ 3) % Row 11 \SetRowColor{white} tel & pour un numéro de téléphone \tn % Row Count 20 (+ 1) % Row 12 \SetRowColor{LightBackground} url, mail & pour une url, un mail \tn % Row Count 22 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{date, time et datetime} \tn % Row Count 23 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{number, range} \tn % Row Count 24 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{color} \tn % Row Count 25 (+ 1) % Row 16 \SetRowColor{LightBackground} search & entrer un mot clef de recherche \tn % Row Count 26 (+ 1) % Row 17 \SetRowColor{white} \textless{}datalist\textgreater{} & liste de complétion suggérée, pas imposé ) \tn % Row Count 28 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{margin padding border}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/phil35_1516986433_padding.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{left, right, tob, bottom} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{liens utiles}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{https://caniuse.com/} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Déterminer la généralisation de balises dans le parc des browsers.} \tn % Row Count 3 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}