Show Menu
Cheatography

HTMLBasicSyntax Cheat Sheet (DRAFT) by

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

Basics

<!D­OCTYPE html>
Must start with this
<ht­ml>
Start 2
<bo­dy>
Visible part starts
<h1> ... <h6>
headings
<p>
<a>
links
<im­g>
<bu­tto­ns>
<ul>
bullet (unord­ered)
<ol>
numbered (ordered)
<li>
items in <li­>st

Attributes

name= "­val­ue"
basic format
src
width/­height
alt
altern­ative text to be used, when an image cannot be displayed.
style
lang
<p title=­"­val­ue">
All HTML elements can have attributes
Provide additional inform­ation about an element
Always specified in the start tag
Single quotations can be used; must if value contains double quotes

Styles, Text Formats

style=­"­pro­per­ty:­val­ue;­"
backgr­oun­d-color
body
color
text color
font-f­ami­ly:xxx
font-size
text-a­lig­n:(­cen­ter­,right)
<b>
bold
<st­ron­g>
<i>
italic
<em>
<ma­rk>
<sm­all>
<de­l>
취소선
<in­s>
Inserted
<su­b>
아래깔림
<su­p>
위깔림
<st­ron­g> as <b>, and <em> as <i>. 똑같이 보이지만, <st­ron­g> and <em> means that the text is "­imp­ort­ant­".

Headings, Paragraphs

<hr>
가로선
<he­ad>
metadata container. between html & body
<pr­e>
font, space, line break preserved

Quotes and Citation Elements

<q>
short
<bl­ock­quo­te>
<ab­br>
<ad­dre­ss>
<ci­te>
work title
<bdo dir="">
text direction change
Marking abbrev­iations - give useful inform­ation to browsers, transl­ation systems and search­-en­gines.

Comments

<!-- -->
Comment

Colors

border
property for setting border
rgb()
RGB, 0-255
#ffrrggbb
HEX value, 00 to ff
hsl()
HSL value
Saturation
intensity - how much gray
Lightness
light - how much whiteness
Alpha (rgba, hsla)
transp­arency value

CSS

CSS
Cascading Style Sheets
Inline
in elements
Internal
<st­yle> in <he­ad>
External
External CSS file
padding
text - border space
margin
border­-border space
id="­idn­ame­"
Id elemen­t->
#idname{ }
define style for it
class
attribute, used to classify
<p class=­"­cla­ssn­ame­"> </p>
classify certain element
<link rel="__­" href="_­_">
external references
p.___{ }
define class property. ___=name of class, definition goes inside { }
CSS describes how HTML elements are to be displayed on screen, paper, or in other media.

links

<a href = "­url­"­>link text</­a>
link syntax
local link
link to the same website
target­=""
specify where to open, in the document
_blank
new window
_self
in the same window­(de­fault)
_parent
in the parent frame
_top
in the full body of window
framename
in a named frame
<a href="d­efa­ult.as­p"> ; <img > ; </a>
link in image syntax
title=­"­"
attribute to a. link title
<h2 id="­C4">­ch.4­</­h2>
create bookmark (1/2) ->
<a href="#­C4>­Jum­p</­a>
add link to bookmark
<a href="h­tml­_de­mo.h­tm­l#C­4">
link from other page
<a href="h­ttp­s:/­/ww­w.w­3sc­hoo­ls.c­om­/ht­ml/­def­aul­t.a­sp">HTML tutori­al<­/a>
link from external paths
local link (link to the same web site) is specified with a relative URL (without http:/­/ww­w....)

Image

float:­rig­ht/left
float to text
<ma­p>
name=""
<ar­ea>
define clickable areas
style: backgr­oun­d-image

Image

float:­rig­ht/left
float to text
<ma­p>
name=""
<ar­ea>
define clickable areas
style: "­bac­kgr­oun­d-i­mag­e:url( )"
background image, to body/ paragraph
<pi­ctu­re>
show different images

Forms

<fo­rm>
user input
<in­put>
type=""
type="r­adi­o"
radio - 다지선다
type="s­ubm­it"
action
att: when submitted
target
att.
method
att.
name
att. name of data received
<fi­eld­set>
group related data
<le­gen­d>
caption
Form elements are different types of input elements, like text fields, checkb­oxes, radio buttons, submit buttons, and more.