HTML

Creating Tables

                <table>
                    <tr>
                        <th></th>
                        <th scope="col">Column 1</th>
                        <th scope="col">Column 2</th>
                    </tr>
                    <tr>
                        <th scope="row">Row Header</th>
                        <td>Table Data</td>
                        <td>Table Data</td>
                    </tr>
                </table>
            

Table Head, Table Body & Table Footer

                <table>
                    <!-- Table Head -->
                    <thead>
                        <tr>
                            <th></th>
                            <th scope="col">Column 1</th>
                            <th scope="col">Column 2</th>
                        </tr>
                    </thead>

                    <!-- Table Body -->
                    <tbody>
                        <tr>
                            <th scope="row">Row Header</th>
                            <td>Table Data</td>
                            <td>Table Data</td>
                        </tr>
                    </tbody>

                    <!-- Table Footer -->
                    <tfoot>
                        <tr>
                            <th>Table Footer</th>
                            <td> </td>
                            <td> </td>
                        </tr>
                    </tfoot>
                </table>
            

Column Span & Row Span

                <!-- Column Span -->
                <td colspan="2">This column spans 2 columns</td>

                <!-- Row Span -->
                <td rowspan="2">This row spans 2 rows</td>
            

Header

                <!-- Method 1: header tag -->
                <header>
                    <!-- Navigation or introductory content -->
                </header>

                <!-- Method 2: div tag with header id -->
                <div id="header>
                    <!-- Navigation or introductory content -->
                </div>
            

Footer

                <footer>
                    <!-- footer content -->
                </footer>
            

Section & Article

                <section>
                    <article>
                        <!-- body content -->
                    </article>
                </section>
            

Aside

                <aside>
                    <!-- aside content -->
                </aside>
            

Attaching Images - Figure & Figcaption

                <figure>
                    <img src="image-link">
                    <figcaption>Image Description</figcaption>
                </figure>
            

Attaching Audio

                <audio controls>
                    <source src="audio-file-link/url" type="audio/mp3">
                </audio>
            

Attaching Video & Gifs

                <video src="video-file-link/url" controls>
                    Video not supported
                </video>

                <!-- Attaching Gifs -->
                <embed src="gif-file-link/url"/>
            

CSS

3 ways of adding CSS to HTML: Inline Styles, Internal Stylesheet & External Stylesheet.

The Box Model

min-width: 300px;
max-width: 600px;
min-height: 300px;
min-height: 300px;

Box-Sizing [Doc]

box-sizing: border-box;
  • border-box; - changes box model to include the padding, margin and borders within the element width specified.
  • By default, the padding, margin and borders add on to the element's width.

Border [Doc]

border: 1px solid black;
border: border-width border-style border-color;

Border Radius [Doc]

border-radius: 5px;

Overflow [Doc]

overflow: scroll;

Accessing different Selectors in CSS

                element-name { }

                .class-name { }
                
                #id-name { }
                
                [attribute-name]{ }

                :Pseudo-class-name { }
            

Universal Selector [Doc]

                * { 
                    margin: 0;
                    padding: 0;
                }
            

Text

Font Family [Doc]

font-family: Garamond;

Font Weight [Doc]

font-weight: bold;

Font Style [Doc]

font-style: italic;

Text Align [Doc]

text-align: right;

Text Transformation [Doc]

text-transform: uppercase;

Text Layout

text-transform: uppercase;

Colour

    Ways to represent colour:
  1. Hexadecimal: #8FBC8F
  2. RGB: rgb(23, 45, 23)
  3. Hue, Saturation, and Lightness: hsl(120, 60%, 70%)
    Opacity - include "a"
  • hsla(34, 100%, 50%, 0.1)
  • rgba(234, 45, 98, 0.33)
  • Named color keyword for zero opacity - transparent - color: transparent;

Text Colour [Doc]

color: red;

Background Colour [Doc]

background-color: blue;

Opacity [Doc]

opacity: 0.5;

Background Image [Doc]

background-image: url('image-link / filepath');

Visibility [Doc]

visibility: hidden;

Positioning

Position [Doc]

position: static;
  • Changes the position of an element.
  • Values: static, relative, absolute, fixed, sticky

Z-Index [Doc]

z-index: 1;
  • Needs to be paired with any position values, besides static.
  • Element with larger Z-index is at the front.

Display [Doc]

display: inline;
  • Makes it possible for elements to be inline.

Float [Doc] & Clear [Doc]

float: right;
  • Floats elements as far left/right as possible.
clear: left;
  • Floats may allow multiple elements to float.
  • Clear defines how these float elements should behave when they bump onto each other.