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

<div>
    <p>This is a list of the UEFA Champions League winners for the past 5 years.</p>
    <a href="https://en.wikipedia.org/wiki/List_of_European_Cup_and_UEFA_Champions_League_finals"><button>Source: All-time UEFA Champions League Winners</button></a>
</div>

<div>
    <br>
    <p><b>The 2018-19 Champions League final</b> was played between <b>Liverpool</b> and <b>Tottenham Hotspur</b> at the Metropolitano Stadium in Madrid, Spain. <b>Liverpool</b> won the game <b>2-0</b>.</p>
    <p>Click on the image below for more information about the match.</p>
    <a href="https://en.wikipedia.org/wiki/2018%E2%80%9319_UEFA_Champions_League"><img src="https://cdn.vox-cdn.com/thumbor/zQL38YWc15GfSXuDylA4atRuLac=/0x0:4097x2731/1200x800/filters:focal(2267x671:2921x1325)/cdn.vox-cdn.com/uploads/chorus_image/image/63933989/1153093191.jpg.0.jpg"></a><br><br>
    <p><b>The 2019-20 Champions League final</b> was played between <b>Bayern Munich</b> and <b>Paris Saint-Germain</b> at the Estádio da Luz stadium in Lisbon, Portugal. <b>Bayern Munich</b> won the game <b>1-0</b>.</p>
    <p><b>FUN FACT:</b> This match was played behind closed doors due to the COVID-19 pandemic. Click on the image below for more information about the match.</p>
    <a href="https://en.wikipedia.org/wiki/2019%E2%80%9320_UEFA_Champions_League"><img src="https://i2-prod.mirror.co.uk/incoming/article23908401.ece/ALTERNATES/s615b/0_Champions-League-Quarter-Final-Second-Leg-Paris-St-Germain-v-Bayern-Munich.jpg"></a><br><br>
    <p><b>The 2020-21 Champions League final</b> was played between <b>Manchester City</b> and <b>Chelsea</b> at the Estádio do Dragão stadium in Porto, Portgual. <b>Chelsea</b> won the game <b>1-0</b>.</p>
    <p><b>FUN FACT:</b> This match was played with a limited attendance due to the COVID-19 pandemic. Click on the image below for more information about the match.</p>
    <a href="https://en.wikipedia.org/wiki/2020%E2%80%9321_UEFA_Champions_League"><img src="https://cdn.vox-cdn.com/thumbor/okTCEToiN8-ZqNRYTkjuuxC8sDc=/0x0:3901x2601/1200x800/filters:focal(1130x236:1754x860)/cdn.vox-cdn.com/uploads/chorus_image/image/69904041/1321404820.0.jpg"></a><br><br>
    <p><b>The 2021-22 Champions League final</b> was played between <b>Liverpool</b> and <b>Real Madrid</b> at the Stade De France in Saint-Denis, France. <b>Real Madrid</b> won the game <b>1-0</b>.</p>
    <p>Click on the image below for more information about the match.</p>
    <a href="https://en.wikipedia.org/wiki/2021%E2%80%9322_UEFA_Champions_League"><img src="https://media.cnn.com/api/v1/images/stellar/prod/220528220437-madrid-goal.jpg?c=original"></a><br><br>
    <p><b>The 2022-23 Champions League final</b> was played between <b>Manchester City</b> and <b>Inter Milan</b> at the Atatürk Olympic Stadium in Istanbul, Turkey. <b>Manchester City</b> won the game <b>1-0</b>.</p>
    <p>Click on the image below for more information about the match.</p>
    <a href="https://en.wikipedia.org/wiki/2022%E2%80%9323_UEFA_Champions_League"><img src="https://cdn.theathletic.com/app/uploads/2023/06/10164133/rodri-city-goal-1024x689.jpg"></a><br><br>
</div>

This is a list of the UEFA Champions League winners for the past 5 years.


The 2018-19 Champions League final was played between Liverpool and Tottenham Hotspur at the Metropolitano Stadium in Madrid, Spain. Liverpool won the game 2-0.

Click on the image below for more information about the match.



The 2019-20 Champions League final was played between Bayern Munich and Paris Saint-Germain at the Estádio da Luz stadium in Lisbon, Portugal. Bayern Munich won the game 1-0.

FUN FACT: This match was played behind closed doors due to the COVID-19 pandemic. Click on the image below for more information about the match.



The 2020-21 Champions League final was played between Manchester City and Chelsea at the Estádio do Dragão stadium in Porto, Portgual. Chelsea won the game 1-0.

FUN FACT: This match was played with a limited attendance due to the COVID-19 pandemic. Click on the image below for more information about the match.



The 2021-22 Champions League final was played between Liverpool and Real Madrid at the Stade De France in Saint-Denis, France. Real Madrid won the game 1-0.

Click on the image below for more information about the match.



The 2022-23 Champions League final was played between Manchester City and Inter Milan at the Atatürk Olympic Stadium in Istanbul, Turkey. Manchester City won the game 1-0.

Click on the image below for more information about the match.