Show Menu
Cheatography

torvak-web-development-cheatsheet Cheat Sheet (DRAFT) by

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

HTML page skeleton

<!DOCTYPE html>
<html>
  <head>
    <title>Page Title</title>
    <html lang="fr">
    <meta charset="UTF-8">
    <meta name="description" content="Description of the website">
    <meta name="keywords" content="keyword1,keyword2,keyword3,...">
    <meta name="author" content="Hege Refsnes">
    <link rel="stylesheet" href="styles.css">
    <script src="myJSscript_src.js"></script>
    <script src="jquery-3.1.1.min.js"></script> 
  </head>
  <body>
    <div id="main">
       <header>
          <h1>mon titre</h1>
       </header>
       <section>
       </section>
       <footer>
         <p>texte du footer</p>
       </footer>
   </div>
</body>
</html>

HTML Forms

-------------Normal data form--------------
<form action="action_page.php" method ="post">
  First name:<input type="text" name="firstname" placeholder="First name"><br>
  Last name:<input type="text" name="lastname" placeholder="First name"><br>
  <input type="hidden" name="country" value="Norway">
  <input type="submit" value="Submit" name ="submit">
</form>
-------------File upload form--------------
<form action="upload.php" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="fileToUpload" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form>

Select list

<select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
 

Ways to reduce page loading time

Reduce image size
Remove unnece­ssary widgets
HTTP compre­ssion
Placing CSS at the top and script reference at the bottom or in external files
Reduce lookups
Minimize redirects
Caching

About CSS

Variations
CSS, CSS1, CSS2, CSS2.1, CSS3, CSS4
3 ways of integr­ation
>in­lin­e(html attribute)
>em­bedded (in head element)
> linked­/im­ported (in head via external file)

CSS Tricks

Center block elements with CSS1
margin­-le­ft:­auto; margin­-ri­ght­:auto