Home HTML Data Types DOM JavaScript JS Debugging

How does HTML work?

Similar function to Markdown, syntax defines how stuff should be displayed

  • HTML is based on beginning and closing tags <tagname>content</tagname>
    • Note the “/” on the ending or closing tag of the pair

Compare markdown to html below

This below example shows comparison of a heading and paragraph. Click on links to see many more HTML examples.

%%markdown

### Markdown: This is a Heading

This is a paragraph

Markdown: This is a Heading

This is a paragraph

%%html

<h3>HTML: This is a Heading</h3>
<p>This is a paragraph.</p>

HTML: This is a Heading

This is a paragraph.

Attributes

  • Learn about attributes
  • Tags can have additional info in the form of attributes
  • Attributes usually come in name/value pairs like: name=”value”
<tagname attribute_name="attribute_value" another_attribute="another_value">inner html text</tagname>
  • href example with attribute for web link and inner html to describe link
<a href="https://www.w3schools.com/html/default.asp">Visit W3Schools HTML Page</a>

Sample Markdown vs HTML Tags

Image Tag - Markdown

![describe image](link to image)

Image Tag - HTML

<!-- no content so no end tag, width/height is optional (in pixels) -->
<img alt="describe image" src="link to image" width="100" height="200">

Link Tag - Markdown

[link text](link)

Link Tag - HTML

<a href="link">link text</a>

Bolded Text - Markdown

**Bolded Text**

Bolded Text - HTML

<strong>Bolded Text</strong>

Italic Text - Markdown

*Italic Text*

Italic Text - HTML

<i>Italic Text</i>

More tags (not really in markdown)

P tag (just represeants a paragraph/normal text)

<p>This is a paragraph</p>

Button

<button>some button text</button>

Div (groups together related content)

<!-- first information -->
<div>
    <!-- notice how tags can be put INSIDE eachother -->
    <p>This is the first paragarph of section 1</p>
    <p>This is the second paragraph of section 1</p>
</div>

<!-- second information -->
<div>
    <!-- notice how tags can be put INSIDE eachother -->
    <p>This is the first paragarph of section 2</p>
    <p>This is the second paragraph of section 2</p>
</div>

Resources

  • https://www.w3schools.com/html/default.asp
  • I will show a demo of how to find information on this website

HTML Hacks

  • Below is a wireframe for an HTML element you will create. A wireframe is a rough visual representation of HTML elements on a page and isn’t necessarily to scale or have the exact styling that the final HTML will have. Using the syntax above, try to create an HTML snippet that corresponds to the below wireframe.
  • The “a tags” can contain any links that you want

wireframe for html hacks

%%html
<html lang="eng-US">

<div>
    <h2> Seattle Seahawls</h2>
   
    <p><strong> Team Background</strong> 

        <br><br>
        The Seattle Seahawks are an NFL team from the city of Seattle. They were founded in 1976 and joined the NFC West Division. Their main rivals are the San Fransicso 49ers and the Los Angeles Rams.
        <br><br>
    </p>


    <button> Main Players<br><br>
            
            1. Geno Smith<br>
            2. DK Metcalf<br>
            3. Kenneth Walker III <br>
            4. Tyler Lockett<br>
            5. Bobby Wagner<br>
            6. Tariq Woolen<br>
            
            
    </button>
    <br>
    <button onclick="goToSeahawksWebsite()">Go to Seahawks Website</button>

    <script>
        function goToSeahawksWebsite() {
            // Redirect to the Interstellar Wikipedia page
            window.location.href = "https://www.seahawks.com/";
        }
</script>

</div>
<br>
<center>
    <img src="https://seahawkswire.usatoday.com/wp-content/uploads/sites/61/2023/05/SEA_2023_schedule-1.png?w=1000&h=600&crop=1" alt="The_Seahawks_Schedule_poster" height="320" width="900"> </center>
    </center>
<br><br>
<div>

    <h2>Miami Dolphins</h2>
    <center>
    <img src="https://wallpapercave.com/wp/wp11892554.jpg" height="320" width="900"> </center>

    <a href="https://twitter.com/MiamiDolphins">Dolphins: Twitter</a><br>
    <a href="https://www.miamidolphins.com/">Dolphins: Team Website</a>

    <br><br>
     
    <p> <strong> Team Background</strong>
        <br><br>
        The Miami Dolphins are currently one of the best teams in the NFL right now. The are number on in the league and recently beat the Denver Broncos 70-20. The best players on the Miami Dolphins are Tyreek Hill, Tua Tagovailoa, and Jaylen Waddle</p>
        <br>
    
        
</div>
</html>
<!-- put your HTML code in this cell, Make sure to press the Run button to see your results below -->

Seattle Seahawls

Team Background

The Seattle Seahawks are an NFL team from the city of Seattle. They were founded in 1976 and joined the NFC West Division. Their main rivals are the San Fransicso 49ers and the Los Angeles Rams.



The_Seahawks_Schedule_poster
</center>

Miami Dolphins

Dolphins: Twitter
Dolphins: Team Website

Team Background

The Miami Dolphins are currently one of the best teams in the NFL right now. The are number on in the league and recently beat the Denver Broncos 70-20. The best players on the Miami Dolphins are Tyreek Hill, Tua Tagovailoa, and Jaylen Waddle