0% found this document useful (0 votes)
130 views5 pages

Ibm Cheatsheet

This document provides a cheat sheet of common HTML elements and their descriptions. It includes elements for structuring the document like <html>, <head>, and <body>, as well as elements for text formatting like <h1> and <p>. It also covers common elements for embedding content like <img> and <script> and styling content with <style> and <link>. The cheat sheet provides examples of how each element is written and used in HTML code.

Uploaded by

Asrar Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views5 pages

Ibm Cheatsheet

This document provides a cheat sheet of common HTML elements and their descriptions. It includes elements for structuring the document like <html>, <head>, and <body>, as well as elements for text formatting like <h1> and <p>. It also covers common elements for embedding content like <img> and <script> and styling content with <style> and <link>. The cheat sheet provides examples of how each element is written and used in HTML code.

Uploaded by

Asrar Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to Web Development with HTML, CSS, and JavaScript

HTML Elements Cheat Sheet


HTML Tags

Element Description Example


<!-- --> This tag denotes a comment in HTML, which is not <!-- This is a comment -->
displayed by a browser but can be useful to hide and
document code.
<!DOCTYPE html> All HTML documents must start with this declaration. It tells <!DOCTYPE html>
the browser what document type to expect. Note that this <html>
element has no ending tag. <head>
<title>Document Title</title>
</head>
<body>
Document body here
</body>
</html>
<a href= “path”> This tag, called an “anchor tag” creates hyperlinks using the <a href="https://www.ibm.com">IBM</a>
href attribute. In place of path enter the URL or path name to
the page you want to link to.
<body> Contains the contents of the HTML document. It should <!DOCTYPE html>
contain all other tags besides the <head> element to display <html>
the body of the document. <head>
<title>Document Title</title>
</head>
<body>
Document body here
</body>
</html>
<div> Often used to separate sections in the body of a document in <div>
order to style that content with CSS. This element has no particular semantic
meaning but is often used in conjunction
with CSS for styling purposes.
</div>
<h1> Adds a level 1 heading to the HTML document. <h1>Thomas J. Watson</h1>
<head> Contains metadata and should be placed after the <html> tag <!DOCTYPE html>
and before the <body> tag. <html>
<head>
<title>Document Title</title>
</head>
<body>
Document body here
</body>
</html>
<html> The root element of an HTML document. All other tags in <!DOCTYPE html>
the document should be contained in this tag. <html>
<head>
<title>Document Title</title>
</head>
<body>
Document body here
</body>
</html>
<img src=“path” This tag is used to place an img. In place of path insert a <img
width=“dim1” URL or a relative file path to the image location. Other src=“https://upload.wikimedia.org/wikipedia/commons
height=“dim2”> optional attributes include width and height of the image in /
pixels. 7/7e/Thomas_J_Watson_Sr.jpg” width=“300”
height=“300”>
<li> Element that creates bulleted line items in an ordered or <ul>
unordered list. Should be used in conjunction with the <ul> <li>Bullet point 1</li>
or <ol> tags. <li>Bullet point 2</li>
</ul>
<link> Used to link a CSS document to an HTML document. <head>
<link rel=“stylesheet” href=“styles.css”>
</head>
<meta> Used to provide metadata about the HTML document. <head>
<meta name=“author” content=“Christopher Moore”>
</head>
<ol> Element that creates an ordered list using numbers. Should <ol>
be used in conjunction with the <li> tag. <li>Numbered bullet point 1</li>
<li>Numbered bullet point 2</li>
</ol>
<p> This tag is used to identify a paragraph. It places a line break <p>Thomas J. Watson, Sr. is the American
after the text it is enclosed in. industrialist, who built the International Business
Machines Corporation (IBM) into the largest
manufacturer of electric typewriters and data-
processing equipment in the world.</p>
<script> Used to embed JavaScript in an HTML document. <script>
alert(“Hello World”);
</script>
<style> Used to apply simple CSS to an HTML document. <head>
<style>
p {color:red}
</style>
</head>
<body>
<p>This paragraph will be red because I’ve styled
the paragraph tag with CSS.</p>
</body>
<table> This tag is used to denote a table. Should be used with <tr> <table>
(defines a table row) and <td> (defines a table cell within a <tr>
row) tags. The <th> tag can also be used to define the table <th>Header cell 1</th>
header row. <th>Header cell 2</th></tr>
<tr>
<td>First row first cell</td>
<td>First row second cell</td>
</tr>
<tr>
<td>Second row first cell</td>
<td>Second row second cell</td>
</tr>
</table>
<td> Denotes a cell within a row, within a table. <table>
<tr>
<th>Header cell 1</th>
<th>Header cell 2</th>
</tr>
<tr>
<td>First row first cell</td>
<td>First row second cell</td>
</tr>
<tr>
<td>Second row first cell</td>
<td>Second row second cell</td>
</tr>
</table>
<th> Denotes the header cells within a row within a table. <table>
<tr>
<th>Header cell 1</th>
<th>Header cell 2</th>
</tr>
<tr>
<td>First row first cell</td>
<td>First row second cell</td>
</tr>
<tr>
<td>Second row first cell</td>
<td>Second row second cell</td>
</tr>
</table>
<title> Defines the title of the HTML document displayed in the <!DOCTYPE html>
browser’s title bar and tabs. It is required in all HTML <html>
documents. It should be contained in the <head> tag. <head>
<title>Document Title</title>
</head>
<body>
Document body here
</body>
</html>
<tr> Denotes a row within a table. <table>
<tr>
<th>Header cell 1</th>
<th>Header cell 2</th>
</tr>
<tr>
<td>First row first cell</td>
<td>First row second cell</td>
</tr>
<tr>
<td>Second row first cell</td>
<td>Second row second cell</td>
</tr>
</table>
<ul> Element that creates an unordered list using bullets. Should <ul>
be used in conjunction with the <li> tag. <li>Bullet point 1</li>
<li>Bullet point 2</li>
</ul>

You might also like