Home | HTML | JavaScript | DOM | Data Types |
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
<style>
button {
background-color: #4E804F;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
}
button:hover {
background-color: darkgreen;
}
a {
color: white;
text-decoration: none;
}
a:hover {
color: #D1D9CE;
}
/* Additional styles for better presentation */
div {
margin: 20px;
}
.top {
background-color: #4E804F;
padding: 10px 0;
text-align: center;
}
.top a {
margin: 0 20px;
}
h1 {
text-align: center;
}
</style>
</head>
<body>
<header>
<h1>☆ Online Grocery Store! ☆</h1>
</header>
<nav class=“top”>
<a href=“/”>☆ Home</a>
<a href=“/fruits”>☆ Fruits</a>
<a href=“/vegetables”>☆ Vegetables</a>
<a href=“/dairy”>☆ Dairy</a>
</nav>
<section>
<h2>Shop Now</h2>
<p>Explore a wide variety of fresh and delicious groceries.</p>
<button>Start Shopping</button>
</section>
<section>
<h2>Our Products</h2>
<p>Discover the finest selection of fruits, vegetables, and dairy products.</p>
<a href=“/fruits”>Fruits</a>
<a href=“/vegetables”>Vegetables</a>
<a href=“/dairy”>Dairy</a>
</section>
</body>
</html>
</head>
☆ Online Grocery Store! ☆
Shop Now
Explore a wide variety of fresh and delicious groceries.
Our Products
Discover the finest selection of fruits, vegetables, and dairy products.
<a href=“/fruits”>Fruits</a> <a href=“/vegetables”>Vegetables</a> <a href=“/dairy”>Dairy</a></html>