HTML Cheatsheet
HTML Cheatsheet
Lists
<ul>
<li>The Origins I: HTML</li>
<li>The Origins II: CSS</li>
</ul>
HTML Structure
HTML: Structure
<DOCTYPE html>
<!-- doc type declaration [must have] at the top of a .html file -->
<html> <!-- contain all the code processed on the page -->
<head>
<!-- all the info for the browser that isn’t visible on the page -->
<title> <!-- assign text to the tab in the browser --> </title>
</head>
<body>
<!-- all the content that will end up seeing on the page —>
<header>
<nav> <!-- feature links for navigation --> </nav>
</header>
<main>
<!-- the main topics or ideas shown on the page / there should only be one
single <main> element in every page —>
<section>
<!-- group related content and can have multiple sections
explicit display what each is about
-->
<article> <!-- singular piece of content --> </article>
</section>
</main>
<footer> <!-- other infos, like creator’s name --> </footer>
</body>
</html>
OBS:
<article> and <section> should begin with a heading element.
You CAN nest an <article> within another <article> = usually done if there is
a piece of standalone markup within a single piece of content.
HTML: Structure
Additional setting used to customize class
an element. <!-- can have multiples
-->
<element name=" “> <p class=“first-value second-value
<!-- name indicate the attribute third-value“>Hello World</p>
that are setting for the element
--> id
</element> <!--
can only have ONE with no space.
Example: every id value should be UNIQUE in
<ol type=“a"> the entire page.
<li>The Origins I: HTML</li> can be used to link to another
<li>The Origins II: CSS</li> part of the same page
</ol> -->
<!-- Result:
a. The Origins I: HTML Example:
b. The Origins II: CSS <a href=“#brasil“>
--> Link to Brazil
</a>
<img width=“250" alt=“ “ src=“ “> <h2 class=“city" id=“brazil”>
<!-- Brazil
width attribute = sets the width </h2>
of the image
alt attribute = makes the image
more accessible = read the text Style Element & Style Attribute
and describe the image
<style> element: used in the
-->
<head> to style the elements in
the <body>
<a href=“ “ target=“_blank”> </a>
- can use a period . (class) or
<!--
hashtag # (id) to select one or
target attribute = “_blank” opens
more specific elements that have
the URL on a separate tab on the
a matching class or id
browser
-->
Style attribute: stylize certain
aspects of that element
Figure Element Example:
Roses are <span style=“color:red;
<figure>
text-decoration:underline;”> Red
<!-- graphic, image, diagram = are
</span>
grouped together —>
<img width=“ “ src=“ “ alt=“ “/>
<figcaption> <!-- describe one or
multiple pieces of content -->
</figcaption>
</figure>
Form
HTML: Forms
Input
<form action="" method="">
<!-- <input> interactive control for
the form data should go ater is type: used to determine the kind of
</form> </form>
<form>
<input type=“number”> <input type="submit">
<!-- turns the <input> element
<input type=“number“ step=“ “> into a button for submitting the
<!-- step can change how the form data -->
numeric value acts --> </form>
<input type=“number“ min=“ “
max=“ "> <!-- set a value attribute to
<!-- max and min attribute can be change the text in the button -->
used --> <input type=“submit" value=“Submit
Form!”>
Checkbox & Radio
<input> types:
<input type=“checkbox">
<input type=“email">
<!-- a box that is ticket off to
<input type=“password”>
mark the input as "complete" -->
<input type=“radio" name=“option">
<!-- radio is the list options
name attribute puts the radios in Input Validations
the same group of options to choose
<input> types:
from -->
<input type=“email">
<input type=“password”>
<textarea>
<!-- can give a minlength and
<textarea id=“ “ rows=“ “ cols=“ “ maxlength attribute
placeholder=“explain what kind of required attribute = can be applied
data should be entered“> plain to one or more inputs
mini-text editor</textarea> -->
<form>
<label>
<input type="password"