Home | HTML | JavaScript | DOM | Data Types | Javascript Debugging |
How does HTML work?
- Similar function to Markdown, identifies how stuff should be displayed
- HTML is based on tags
<tagname>content</tagname>
- Note the “/” on the ending tag
- See a markdown to html example below
Markdown
# This is a title
HTML
<h1>This is a title</h1>
Attributes
- Tags can have additional info in attributes
- Attributes are in the following format below
<tagname attribute_name="attribute_value" another_attribute="another_value"></tagname>
Some useful tags to know that are similar to markdown
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>
Some new useful tags to know (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
<html>
<head>
<style>
.div1 {
border: none;
background-color: white;
text-align: left;
color: black;
padding-top: 5px;
padding-bottom: 10px;
padding-left: 15px;
padding-right: 15px;
margin-bottom: 10px;
}
.div2 {
border: 5px outset orange;
border-radius: 10px;
background-color: rgb(235, 198, 95);
text-align: left;
color: black;
padding-top: 15px;
padding-bottom: 5px;
padding-left: 15px;
padding-right: 15px;
}
.a1 {
color: rgb(136, 88, 0);
}
</style>
</head>
<body>
<div class="div1">
<p id="toggleParagraph">Click this button to toggle visibility</p>
<button onclick="toggleVisibility()">This is a button</button>
</div>
<div class="div2">
<a class="a1" target="_blank" href="https://frogpants.github.io/student/">Link to Spencer's page</a><br>
<a class="a1" target="_blank" href="https://seannakagawa.github.io/student/">Link to Sean's page</a><br>
<a class="a1" target="_blank" href="https://github.com/Trystan-Schmits/Student1">Link to Trystan's page</a><br>
<a class="a1" target="_blank" href="https://zafeera123.github.io/ZafeerA123/">Link to Zafeer's page</a><br>
<a class="a1" target="_blank" href="https://trystan-schmits.github.io/Student1//c4.1/2023/09/21/Animation-with-Sprites.html">Link to our game</a>
</div>
<script>
function toggleVisibility() {
// Get the paragraph element
var paragraph = document.getElementById('toggleParagraph');
// Toggle visibility
paragraph.style.display = (paragraph.style.display === 'none') ? 'block' : 'none';
}
</script>
</body>
</html>
Click this button to toggle visibility