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
<head>
<style>
.title {
width: 275px;
height: 50px;
background-color: red;
position: relative;
animation-name: backandforth;
animation-duration: 4s;
animation-iteration-count: infinite;
text-align: center;
border-radius: 8px;
}
@keyframes backandforth {
0% {background-color:red; left:0px; top:0px;}
25% {background-color:yellow; left:200px; top:0px;}
50% {background-color:orange; left:400px; top:0px;}
75% {background-color:yellow; left:200px; top:0px;}
100% {background-color:red; left:0px; top:0px;}
}
</style>
</head>
<div class="title">
<h1>City Guesser</h1>
</div>
<div style="font-family: 'Trebuchet MS', sans-serif;'">
<p>Welcome to City Guesser, a game where that helps you learn cities through their satellite images. Cities are displayed and the goal is to guess them. Correct guesses give a point, while incorrect guesses lose all your points.</p>
<button onclick="window.location.href = '../2023/09/07/JavaScript-Images.html';" style='width: 100%; background-color: orangered; color: white; padding: 14px 20px; margin: 8px 0; border: none;border-radius: 4px; cursor: pointer; font-size: 20px;'>Click Here to Play!</button>
</div>
<div style='font-family: "Lucida Console", "Courier New", monospace;'>
<a href='https://en.wikipedia.org/wiki/List_of_municipalities_in_California'>Valid Cities List (30K+)</a>
<br>
<a href='https://earth.google.com/web/'>Google Earth - Image Source</a>
<p>Some of the above links may be useful.</p>
</div>
City Guesser
Welcome to City Guesser, a game where that helps you learn cities through their satellite images. Cities are displayed and the goal is to guess them. Correct guesses give a point, while incorrect guesses lose all your points.