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

<!-- The passion that I have -->
<h1> <strong> Basics of HTML hacks </strong> </h1>
<div>
    <style>
        .box {
            width: 525px;
            padding: 15px;
            margin: 10;
            background-color: rgb(197, 197, 171);
        }

        .text {
            font-size: 13px;
            color: black;
        }
    </style>

</div>
<div class="box">
    <p class="text"> The thing that I am most passionate about is probably going to be Soccer. My passion for soccer is not just liking the sport, but also the connections that I have among my teammates and my friends. Soccer made me and my teammates and friends bonded together, feeling like a big family. 
    </p>
</div>

<br>


<!--This is the button that goes to the passion-->
<div>
<style>
      button {
        width: 200px;
        height: 75px;
        font-size: 28px;
        background-color: white;
        animation: rgb 3s linear infinite alternate;
      }

      @keyframes rgb{
        0% {
            background-color: red;
        }

        20%{
            background-color: yellow;
        }

        40%{
            background-color: green;
        }

        60%{
            background-color: blue;
        }

        80%{
            background-color: blueviolet;
        }

        100%{
            background-color: red;
        }
      }
      
</style>
    <div>
        <a href="https://www.sdfacademy.com/"> <button> <strong> CLICK HERE </strong> </button> </a>
    </div>
</div>

<br>


<!--Two links that related to my passions. -->


<div>
    <a herf="https://www.premierleague.com/">Premier League</a>
    <br>
    <a herf="https://www.uefa.com/uefachampionsleague/">UEFAchampionsleague</a>
    <div>
        <style>
            .box2 {
                    width: 525px;
                    padding: 10px;
                    margin: 10;
                    background-color: rgb(197, 197, 171);
            }
        
            .text2 {
                    font-size: 13px;
                    color: black;
            }
        </style>
        
    </div>
    <div class="box2">
            <p class="text2"> To encapsulate, the thing that I'm most passionate about is playing soccer. Playing soccer make me feel happy and bonded with my team and my friends.
            </p>
    </div>
</div>




Basics of HTML hacks

The thing that I am most passionate about is probably going to be Soccer. My passion for soccer is not just liking the sport, but also the connections that I have among my teammates and my friends. Soccer made me and my teammates and friends bonded together, feeling like a big family.



Premier League
UEFAchampionsleague

To encapsulate, the thing that I'm most passionate about is playing soccer. Playing soccer make me feel happy and bonded with my team and my friends.