\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{sally sung} \pdfinfo{ /Title (web-development-quiz2.pdf) /Creator (Cheatography) /Author (sally sung) /Subject (Web Development Quiz2 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}{6464E8} \definecolor{LightBackground}{HTML}{F5F5FD} \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{Web Development Quiz2 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{sally sung} via \textcolor{DarkBackground}{\uline{cheatography.com/216190/cs/47303/}}} \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}sally sung \\ \uline{cheatography.com/sally-sung} \\ \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 14th November, 2025.\\ 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*}{3} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch06) Making Tables}} \tn % Row 0 \SetRowColor{LightBackground} Table & \textless{}table\textgreater{}\textless{}/table\textgreater{} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Table Row & \textless{}tr\textgreater{}...\textless{}/tr\textgreater{} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Table Header & \textless{}tr\textgreater{}\textless{}th\textgreater{}Time\textless{}/th\textgreater{}\textless{}/tr\textgreater{} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Table Data & \textless{}td\textgreater{}National News\textless{}/td\textgreater{} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.34379 cm} x{3.63321 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch06) Table border CSS}} \tn % Row 0 \SetRowColor{LightBackground} Border Collapse & border-collapse: type (separate | collapse) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Border Spacing & border-spacing: value; \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.04057 cm} x{2.93643 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch06) Spanning Rows and Columns}} \tn % Row 0 \SetRowColor{LightBackground} Colspan (stretch row) & \textless{}th colspan="3"\textgreater{}total sum\textless{}/th\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Rowspan (stretch col) & \textless{}td rowspan="2"\textgreater{}content\textless{}/td\textgreater{} \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch06) Table Structure}} \tn % Row 0 \SetRowColor{LightBackground} Caption & \textless{}caption\textgreater{}content\textless{}/caption\textgreater{} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Table Header & \textless{}thead\textgreater{}\textless{}tr\textgreater{}...\textless{}/tr\textgreater{}\textless{}/thead\textgreater{} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Table Footer & \textless{}tfoot\textgreater{}\textless{}tr\textgreater{}...\textless{}/tr\textgreater{}\textless{}/tfoot\textgreater{} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} Column Groups & \textless{}table\textgreater{}\textless{}colgroup\textgreater{}columns\textless{}/colgroup\textgreater{}table rows\textless{}/table\textgreater{} \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.29402 cm} x{3.68298 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch06) Table CSS}} \tn % Row 0 \SetRowColor{LightBackground} Caption Side & caption-side: position; (top | bottom) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Text Align & text-align: position; (right | left) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Vertical Align & vertical-align: type; (top | bottom | middle) \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Display & display: type; (table | table-inline | table-row | table-row-group | table-header-group | table-footer-group | table-column | table-column-group | table-cell | table-caption \tn % Row Count 12 (+ 6) % Row 4 \SetRowColor{LightBackground} Columns & columns: width count; \tn % Row Count 13 (+ 1) % Row 5 \SetRowColor{white} Column Count & column-count: value; \tn % Row Count 15 (+ 2) % Row 6 \SetRowColor{LightBackground} Column Rule & column-rule: 2px solid gray; \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch06) Managing Column Breaks}} \tn % Row 0 \SetRowColor{LightBackground} Orphans & orphans: 2; (최소 몇 줄이 아래에 있어야 하는지) \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} Widows & widows: 1; (최소 몇 줄이 위에 있어야 하는지) \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} Break Before & break-before: type; (auto | always | avoid) \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} Break After & break-after: type; (auto | always | avoid) \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} Break Inside & break-inside: type; (auto | avoid) \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} Column Span & column-span: type; (none | all) (해당 요소가 전체 컬럼 차지) \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.24425 cm} x{3.73275 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch07) Starting a Web Form}} \tn % Row 0 \SetRowColor{LightBackground} Form & \textless{}form action="submit.php" method="post"\textgreater{}...\textless{}/form\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Script & \textless{}script src="rb\_forsubmit.js"\textgreater{}\textless{}/script\textgreater{} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Field Set & \textless{}fieldset id="custInfo"\textgreater{}...\textless{}/fieldset\textgreater{} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Legend & \textless{}legend\textgreater{}Contact\textless{}/legend\textgreater{} \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} Label & \textless{}label for="custInfo"\textgreater{}사용자명\textless{}/label\textgreater{} \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} Label + Input & \textless{}label for="visit"\textgreater{}Date of visit\textless{}/label\textgreater{}\textless{}input name="visitDate" id="visit" type="date" /\textgreater{} \tn % Row Count 12 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.04057 cm} x{2.93643 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch07) Creating a Selection List}} \tn % Row 0 \SetRowColor{LightBackground} Selection List & \textless{}select name="orderType" id="order"\textgreater{} \textless{}option value="order1"\textgreater{}Carry out\textless{}/option\textgreater{} \textless{}option value="order2"\textgreater{}Delivery\textless{}/option\textgreater{} \textless{}option value="order3" selected\textgreater{}Dine in\textless{}/option\textgreater{} \textless{}option value="order4"\textgreater{}Take 'n bake\textless{}/option\textgreater{} \textless{}/select\textgreater{} \tn % Row Count 10 (+ 10) % Row 1 \SetRowColor{white} Selection List To Scroll Box & \textless{}select size="4"\textgreater{}...\textless{}/select\textgreater{} \tn % Row Count 12 (+ 2) % Row 2 \SetRowColor{LightBackground} Multiple & \textless{}select multiple\textgreater{}...\textless{}/select\textgreater{} \tn % Row Count 14 (+ 2) % Row 3 \SetRowColor{white} Organize Selection List & \textless{}optgroup label="label1"\textgreater{}\textless{}option\textgreater{}text1\textless{}/option\textgreater{}\textless{}option\textgreater{}text2\textless{}/option\textgreater{}\textless{}/optgroup\textgreater{} \tn % Row Count 18 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch07) Other Form Controls}} \tn % Row 0 \SetRowColor{LightBackground} Text Area & \textless{}textarea name="comment" rows="4"\textgreater{}\textless{}/textarea\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Data List & \textless{}input type="text" list="suggestions" /\textgreater{} \textless{}datalist id="suggestions"\textgreater{}...\textless{}/datalist\textgreater{} \tn % Row Count 5 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.59264 cm} x{3.38436 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch07) Creating Input Boxes}} \tn % Row 0 \SetRowColor{LightBackground} Text & \textless{}input type="text" name="name" /\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Password & \textless{}input type="password" name="pwd" /\textgreater{} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Email / Url & \textless{}input type="email" name="email" /\textgreater{} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Radio & \textless{}input type="radio" name="choice" value="A" checked /\textgreater{} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} Checkbox & \textless{}input type="checkbox" name="agree" value="yes" /\textgreater{} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} Submit / Reset & \textless{}input type="submit" value="register" /\textgreater{} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} Number & \textless{}input type="number" min="1" max="10" /\textgreater{} \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} Range & \textless{}input type="range" name="rate" min="1" max="5" /\textgreater{} \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} Radio Butto Example & \textless{}fieldset class="optGroup"\textgreater{}\textless{}label for="fYes"\textgreater{}Yes\textless{}/label\textgreater{}\textless{}input name="sFriend" id="fYes" value="yes" type="radio" /\textgreater{}\textless{}label for="fNo"\textgreater{}No\textless{}/label\textgreater{}\textless{}input name="sFriend" id="fNo" value="no" type="radio" /\textgreater{}\textless{}/fieldset\textgreater{} \tn % Row Count 24 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.09494 cm} x{3.88206 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch07) Validation Attributes}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Required} & \textless{}input type="text" required /\textgreater{} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{Placeholder} & \textless{}input type="email" \seqsplit{placeholder="user@example}.com" /\textgreater{} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Pattern & \textless{}input type="text" pattern="\textbackslash{}d\{3\}-\textbackslash{}d\{4\}" /\textgreater{} (전화번호 형식 지정) \tn % Row Count 6 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{(Ch07) Validation Styles}} \tn % Row 0 \SetRowColor{LightBackground} Focus & input:focus \{ border: 2px solid blue; \} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Valid & input:valid \{ background-color: lightgreen; \} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{Invalid} & input:invalid \{ background-color: pink; \} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{Checked} & input{[}type=checkbox{]}:checked + label \{ color: green; \} \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}