Show Menu
Cheatography

HTML Cheat Sheet (DRAFT) by

Odin's project HTML

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Basic required things

<!DOCTYPE html>
Tells the browser what language it is reading.
<ht­ml>­</h­tml>
This starts the HTML document, everything is wrapped by this
<!-- -->
Comment.

Inside <ht­ml>­</h­tml>

<head></head>
Contains inform­ation about your HTML file.
<body></body>
Iis where you put your content, such as text, images and links.

Inside <he­ad>­</h­ead>

<title></title>
Cointains the title of the window or the tab.
<style></style>
Better use external styling, this one will override everyt­hing.
<link >
Accepts rel=" " and href=" " inside the tag, doesn't close, will let you add external style sheets.
<meta >
Is used to specify which character set is used, page descri­ption, keywords, author, and other metadata. Metadata is used by browsers (how to display content), by search engines (keywo­rds), and other web services.
<script></script>
Is used to define client­-side JavaSc­ripts.
<base >
specifies the base URL to use for all relative URLs contained within a document.
<noscript></noscript>
Let user know that his browser doesn't support scripting

Attributes of <meta >

name=" "
Specifies a name for the metadata, can contain: applic­ati­on-­name, author, descri­ption, generator, keywords and viewport.
conten­t=" "
Gives the value associated with the http-equiv or name attribute
charse­t=" "
Specifies the character encoding for the HTML document, try UTF-8.
http-equiv=" "
Provides an HTTP header for the inform­ati­on/­value of the content attribute
scheme­=" "
Specifies a scheme to be used to interpret the value of the content attribute
 

Inside <bo­dy>­</b­ody>

<p>­</p>
Defines a paragraph. preferible to breakline (according to stacke­xch­ang).
<h#­></­h#>
Bold, larger letters, accepts numbers from 1 to 6, h4 is equal to <p>­<st­ron­g>.
<a href=" "­></­a>
Inserts a link.
<img src=" " />
Inserts an image, closes with / at the end, inside an <a> can be a hyperlink.
<ol­></­ol>
Ordered list, use <li­></­li> to add elements.
<ul­></­ul>
Unordered list, use <li­></­li> to add elements.
style=­" "
This attribute can be used in paragraph and headings.
<strong></strong>
Strong, bold.
<em­></­em>
Emphasis, cursive.
<ta­ble­></­tab­le>
Usar <tr­></­tr> para crear renglones y <td­></­td> para datos, <th­></­th> para headers además de <th­ead­>, <tb­ody> y <tf­oot> con sus respec­tivos cierres para organi­zar.<c­apt­ion­></­cap­tio­n> para nombrar la tabla.
colspa­n="#­"
Attributo agregado a las tablas para indicar que se expanda # renglones.
<di­v><­/di­v>
Para hacer divisi­ones, pueden ser estili­zadas indepe­ndi­ent­emente con CSS, además de barras, menues y botones.
<fo­rm>­</f­orm>
Defines a form that is used to collect user input, will include many input methods like boxes and choices.

Inside the <fo­rm>­</f­orm>

action­=" "
Is needed to tell the form where its contents will be sent to, sometimes scripts.
method­=" "
How the data in it is going to be sent, get(see what is there) or post(l­eng­htier, invisible, safe).
<input >
You put info here, various types.
type=" "
text(no needed, default. Can have initial value=­" "), passwo­rd(hid letters), checkb­ox(can have checked attrib­ute), radio(­select one), submit­(send form, accepts value=­" " too).
<textarea></textarea>
Accepts rows=" " and cols=" " so you can put large texts.
<se­lec­t><­/se­lec­t>
It's a box with options use <op­tio­n><­/op­tio­n> to give options, and selected and value attrib­utes.
name=" "
Needed, or else will be ignored, those are variable names to be used in the script.
<fi­eld­set­></­fie­lds­et>
Makes a nice delimi­tation in the window
<le­gen­d><­/le­gen­d>
For the fieldset!

Global style=­" " attribute

style="property:value; "
This is the general form to use this attribute, separate with commas aditional proper­ty:­value s.
color
Defines font color, can use words for color, like red, blue and yellow.
backgr­oun­d-color
Same, can use words
font-f­amily
Defines the font to be used for an HTML element, try the generic ones: serif,­san­s-s­eri­f,c­urs­ive­,fa­ntasy and monospace
font-size
Defines the text size for an HTML element, try percen­tages or px
text-align
Defines the horizontal text alignment for an HTML element, try center, left or right.