html body { margin-top: 50px !important; } #top_form { position: fixed; top:0; left:0; width: 100%; margin:0; z-index: 2100000000; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; border-bottom:1px solid #151515; background:#FFC8C8; height:45px; line-height:45px; } #top_form input[name=url] { width: 550px; height: 20px; padding: 5px; font: 13px "Helvetica Neue",Helvetica,Arial,sans-serif; border: 0px none; background: none repeat scroll 0% 0% #FFF; }
paragraphs, and links. HTML works by using tags to define the meaning and purpose of different parts of a web page's content."> Basic (HTML, CSS, JavaScript) Basic (HTML, CSS, JavaScript) In simple words, HTML is the primary building block for creating and structuring website Example of HTML <!DOCTYPE html> HTML works by defining the structure and content of a web page using a series of tags like <!DOCTYPE html> 1 HTML Basics 2 HTML Syntax We need to follow a strict syntax guidelines to write valid HTML code. This includes the use of 1. HTML tags consist of the element name, wrapped in angle brackets. For example, <h1>, <p>, 2. HTML elements are created by enclosing the content of the element inside the opening and 3. HTML attributes are used to provide additional information about HTML elements and are HTML Paragraphs 3 <p> <p>We can use the <br> HTML br tag <br> to add a line break.</p> <p>We can use the <br> HTML br tag <br> to add a line break.</p> 4 We can use other tags like <strong>the strong tag to emphasize text</strong> </p> Paragraph is Block-level HTML Headings HTML Comments Here, <!-- heading 2 --> is a comment. In HTML, comments start with <!-- and ends with --> <div> </div> <h1>Important Heading</h1> 6 HTML Table <tr> <th>Name</th> <th>Age</th> <th>Country</th> </tr> <tr> <td>Harry Depp</td> <td>28</td> <td>Britain</td> </tr> <tr> <td>John Smith</td> <td>35</td> <td>USA</td> </tr> <tr> <td>Ram Krishna</td> 7 <td>Nepal</td> </tr> </table> In the above example, you can see we have used multiple tags to create a table in HTML. • <table> The table row can include either table heading, <th> or table data, <td>. <tr> <th>Name</th> <th>Country</th> </tr> <tr> <td>Prasanna</td> <td>Nepal</td> </tr> <tr> <td>Simon</td> <td>USA</td> </tr> 8 <table> <tr> <th>Item</th> <th>Count</th> </tr> <tr> <td>Mango</td> <td>125</td> </tr> <tr> <td>Orange</td> <td>75</td> </tr> </table> <tr> <td>Apple</td> <td>Mango</td> <td>Orange</td> </tr> 9 Table Border In HTML, the border attribute is used to add a border to a table and all the cells. We use the <thead> tag to add a table head. The <thead> tag must come before any other tags <table> ... Table Body We use the <tbody> tag to add a table body. The <tbody> tag must come after <thead> and <table> 10 ... Table Footer We use the <tfoot> tag to add a table footer. The <tfoot> tag must come after <tbody> and <table> 11 The colspan attribute merges cells across multiple columns. For example, <table> 12 Rowspan The rowspan attribute merges cells across multiple rows. For example, <table> HTML Lists We can use three types of lists to represent different types of data in HTML: Unordered List 13 <ul> <li>Apple</li> <li>Orange</li> <li>Mango</li> </ul> Ordered List The <ol> tag is used to create ordered lists. Similar to unordered lists, each item in the ordered <ol> <li>Ready</li> <li>Set</li> <li>Go</li> </ol> Description List <dl> <dt>HTML</dt> 14 <dd>Cascading StyleSheets</dd> <dt>JS</dt> <dd>Javascript</dd> </dl> <li>Apple</li> <li>Mango</li> <li>Orange</li> <li>Banana</li> </ul> 15 Nesting Lists <ul> <li> Coffee <ul> <li>Cappuccino</li> <li>Americano</li> <li>Espresso</li> </ul> </li> <li> Tea 16 <li>Milk Tea</li> <li>Black Tea</li> </ul> </li> <li>Milk</li> </ul> Similarly, we can also mix list types while nesting and add ordered lists inside the unordered list. <ul> <li> Coffee <ol> <li>Cappuccino</li> <li>Americano</li> <li>Espresso</li> </ol> </li> <li> Tea <ol> <li>Milk Tea</li> 17 </ol> </li> <li>Milk</li> </ul> In our examples, we are nesting the list up to a single level, however, we can also nest lists up to 18 <ol> <li>Name</li> <li>Address</li> <li>Phone Number</li> </ol> Type Description start Attribute <li>Harry</li> <li>Ron</li> <li>Sam</li> </ol> <li>Harry</li> <li>Ron</li> <li>Sam</li> </ol> reversed Attribute <ol reversed> <li>Cat</li> <li>Dog</li> <li>Elephant</li> <li>Fish</li> </ol> Nesting Lists <ol type="I"> <li> Chapter 1 21 <li>Lesson 1</li> <li>Lesson 2</li> </ol> </li> <li> Chapter 2 <ol type="a"> <li>Lesson 1</li> <li>Lesson 2</li> <li>Lesson 3</li> </ol> </li> <li> Chapter 3 <ol type="a"> <li>Lesson 1</li> </ol> </li> </ol> we can also mix list types while nesting and add an unordered list inside the ordered list. For <ol> <li> <ul> <li>Eggs</li> <li>Salt</li> </ul> </li> <li> </li> <li> <ul> <li>Chives</li> <li>Bacon</li> <li>Coriander</li> </ul> </li> </ol> <dl> <dt>HTML</dt> <dt>CSS</dt> 23 However, while creating a description list, it's not necessary that a single <dt> tag (key) should <dt>HTML</dt> <dt>CSS</dt> </dl> 24 <dd>Released in 1993.</dd> </dl> <dl> <dt>HTML</dt> <dt>Python</dt> <dt>Java</dt> </dl> 25 In HTML, we use the <br> tag to create a line break. For example, <p> </p> <p>Use the</p> <p> br tag</p> <p>HTML is Fun</p> <p> 26 </p> In HTML, we use the <pre> tag to create preformatted text. For example, <pre> be shown exactly as it is written. </pre> 27 method: "POST", headers: getHeaders(), body: JSON.stringify(invite), }); </pre> Here we can see that using the HTML <pre> tag is a great way to display code in our HTML <p> method: "POST", headers: getHeaders(), body: JSON.stringify(invite), }); 28 </p> <p>First Paragraph</p> <hr> <p>Second Paragraph</p> The <hr> tag is an empty tag, i.e. it doesn't require a closing tag. <h2>Physics</h2> <p>Physics is the natural science that studies matter, its fundamental constituents, its motion and <hr> <h2>Chemistry</h2> <p>Chemistry is the branch of science that deals with the properties, composition, and structure 29Uploaded by
Kyaw Zin NyeinUploaded by
Kyaw Zin NyeinWhat is HTML?
content.
<html>
<head>
<title>Let’s Learn Programming Myanmar</title>
</head>
<body>
<h1>HTML Tutorial</h1>
<p>You'll learn about HTML.</p>
</body>
</html>In the above program,
• <!DOCTYPE html> - defines that this document is an HTML document
• <html> -root element of an HTML page which encloses all other elements in the HTML
page
• <head> - contains information about the page, such as the title and metadata
• <title> - specifies a title for the HTML page which is shown in the browser's title bar
• <body> - defines the main content of the page and is a container for all the visible
contents, such as headings, paragraphs, lists, etc
• <h1> - defines a heading
• <p> - defines a paragraph of HTML documentHow HTML works?
<h1>, <p>, etc. Each tag has a meaning and can be used to define the purpose of the content it
encloses. For example,
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Let’s Learn Programming Myanmar</title>
</head>
<body>
<center><h1>Let’s Learn Programming Myanmar</h1></center>
<h1>Learn to Code for Free</h1>
<p>
Learn to code with our beginner-friendly tutorials and examples.
Read interactive tutorials, and write and test your code to learn programming.
<p>
<button>Join for free</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>My web page</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>This is my first web page.</p>
<p>It contains a
<strong>main heading</strong> and <em> paragraph </em>.
</p>
</body>
</html>What are HTML Attributes?
<a href="http://example.com"> Example </a>
tags, elements, and attributes, as well as the correct use of indentation and white space. Here are
some key points about HTML syntax:
<img> are some HTML tags.
closing tags of the element.
specified in the opening tag of the element.
4. HTML code should be well-formed and properly indented, with each element on its own line
and each level of hierarchy indented by one level. This makes the code easier to read and
understand and can help to avoid errors. For example,
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>My First HTML Page</h1>
<p> Hello World!</p>
</body>
</html>
The HTML <p> tag is used to create paragraphs. For example,<p>HTML is fun to learn.</p>
<p>Paragraph 1: Short Paragraph</p>
<p>Paragraph 2: Long Paragraph, this is a long paragraph with more text to fill an entire line in
the website.</p>
The paragraph tag removes all extra spaces.The paragraph tag also removes all extra lines.
</p>Adding Line Breaks in Paragraphs
We can use the HTML line break tag, <br>, to add line breaks within our paragraphs. For example,Pre-formatted Text in HTML
<pre>
This text
will be
displayed in the same manner
as it is written
</pre>
Other Elements Inside Paragraphs
<p>
The <p> tag is a block-level element. It starts on a new line and takes up the full width (of its
parent element).Add Extra Space Inside Paragraphs
As discussed earlier, we cannot normally add extra empty spaces inside paragraphs. However,
we can use a certain HTML entity called non-breaking space to add extra spaces. For example,<p>Extra space inside a paragraph</p>
The HTML heading tags (<h1> to <h6>) are used to add headings to a webpage. For example,<h1>This is heading 1.</h1>
<h2>This is heading 2.</h2>
<h3>This is heading 3.</h3>
<h4>This is heading 4.</h4>
<h5>This is heading 5.</h5>
<h6>This is heading 6.</h6>
Headings are block-level elements
The Headings <h1> to <h6> tags are block-level elements. They start on a new line and take up
the full width of their parent element. For example,
5
<h1>Headings</h1> <h2>are</h2> <h3>fun!</h3>
<!-- heading 2 -->
<h2>Comments in HTML</h2><!-- an HTML div -->
<p>HTML is fun to learn.</p>
Single-Line and Multi-line Comments
In HTML, we use the same syntax to create single-line and multi-line comments.<!-- Write a heading -->
<!-- Multiple Line comments
can include line breaks
and also extra spaces -->
<p>this will display in the webpage</p>
HTML Tags Inside Comments
If we put HTML elements inside comments, they will be ignored. For example,<p>this will be displayed</p>
<!-- <p>this will not be displayed</p> -->
<p>this will also be displayed</p>
<table border="1" >
<td>19</td>
• <tr>
• <td>
• <th>Table tag <table> in HTML
The <table> tag is used to define a table. For example,Table Row <tr> in HTML
The <tr> tag is used to define a row in a table. For example,
Table Heading, <th> in HTML
The <th> tag is used to define a table header. It is generally the top row of the table. For
example,Table Cell <td> in HTML
The <td> tag is used to define table cells (data). The table cells store data to be displayed in the
table. For example,In the above example, <td>Apple</td>, <td>Mango</td> and <td>Orange</td> are table
cells.
Table cells are generally inside the table row or table headers.
<table border="1">
...
</table><table border="1" style="border-collapse: collapse;">
...
</table>Table Head, Body, and Footer
The HTML table can be divided into three parts: a header, a body, and a footer.
inside a table. For example,
<thead>
<tr>
<th>Head1</th>
<th>Head2</th>
</tr>
</thead>
...
</table>
before any other tags inside a table. For example,
<thead>
...
</thead>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</tbody>
...
</table>
before any other tags inside a table. For example,
<thead>
...
</thead>
<tbody>
,,,,
</tbody>
<tfoot>
<tr>
<td>foot 1</td>
<td>foot 2</td>
</tr>
</tfoot>
</table>Example: HTML Table Head, Body, and Footer
<table>
<thead>
<tr>
<th>S.N</th>
<th>Item</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Apple</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>Mango</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>Orange</td>
<td>1</td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td>Total</td>
<td>5</td>
</tr>
</tfoot>
</table>Colspan and Rowspan
Colspan
<tr>
<th>S.N</th>
<th>Item</th>
<th>Quantity</th>
</tr>
<tr>
<td>1</td>
<td>Apple</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>Mango</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>Orange</td>
<td>1</td>
</tr>
<tr>
<td colspan="2">Total</td>
<td>5</td>
</tr>
</table>
<tr>
<th>Name</th>
<th>Subject</th>
<th>Marks</th>
</tr>
<tr>
<td rowspan="3">Mark Smith</td>
<td>English</td>
<td>67</td>
</tr>
<tr>
<td>Maths</td>
<td>82</td>
</tr>
<tr>
<td>Science</td>
<td>91</td>
</tr>
</table>
HTML lists are used to display related information in an easy-to-read and concise way as lists. 1. Unordered List <ul>
2. Ordered List <ol>
3. Description List <dl>
The unordered list is used to represent data in a list for which the order of items does not matter.
In HTML, we use the <ul> tag to create unordered lists. Each item of the list must be a <li> tag
which represents list items. For example,
The ordered list is used to represent data in a list for which the order of items has significance.
list must be a <li> tag. For example,
The HTML description list is used to represent data in the name-value form. We use the <dl> tag
to create a definition list and each item of the description list has two elements: • term/title - represented by the <dt> tag
• description of the term - represented by the <dd> tag <dd>Hyper-Text Markup Language</dd>
<dt>CSS</dt>Tags used in HTML lists
Tag Explanation
<ol> Defines an ordered list.
<ul> Defines an unordered list.
<dl> Defines a description list.
<li> Defines a list item in ordered or unordered lists.
<dt> Defines a term in description list.
<dd> Defines the description of a term in the description list.HTML Unordered List
<ul>Unordered Lists Marker
We use the CSS list-style-type property to change the marker that marks the list item. The valid
options for markers are Icon Marker Description
• (default) disc sets the marker to a dot
○ circle sets the marker to a hollow circle
▪ square sets the marker to a filled black square
none removes the marker altogether
In HTML, we can create a nested list by adding one list inside another. For example,
<ul>Ordered List inside Unordered List
For example,
<li>Black Tea</li>Multi-level Nesting of Unordered List
multiple levels. This might be important while creating lists like Table of Content. For example,
19
HTML Ordered ListWe use the <ol> tag to create an unordered list. For example,
Ordered Lists Type
We use the type attribute to change the marker for the list. There are five types of numbering in
the ordered list. They are
"1"(Default) The list is numbered with numbers.
"a" The list is numbered with lower-case alphabets.
"A" The list is numbered with upper-case alphabets.
"i" The list is numbered with lower-case roman numerals.
"I" The list is numbered with upper-case roman numerals.
We use the start attribute to change the starting point for the numbering of the list. For example,
20
<ol start='5'>This attribute also works with other types. For example,
<ol type="a" start='5'>
We can use the reversed attribute on the ordered list to reverse the numbering on the list. For
example,
In HTML, we can create a nested list by adding one list inside another. For example,
<ol type="a">
example, Prepare the ingredients.
22
<li>Butter</li> Mix the ingredients and cook on a low flame.
Serve hot with garnish. You can use
HTML Description List
In HTML, we use the <dl> tag to create a description list. For example, <dd>Hyper Text Markup Language</dd>
<dd>Cascading Style Sheets</dd>
</dl>Here, you can see two different types of list items:
• <dt> - defines the terms/name
• <dd> - defines the description/value of the term/nameMultiple Terms and Multiple Definitions
As we have seen, the definition list is used to display data in a key/value format, where the <dt>
tag indicates the key elements and the <dd> tag element indicates the value (definition) of the
key.
have a single <dd> tag (value). We can have any combination of the <dt> and <dd> elements.Possible Combinations of terms and term descriptions:
• Single term (<dt>) with a single definition (<dd>).
• Multiple terms (<dt>) with a single definition (<dd>).
• Multiple definitions (<dd>) with a single term (<dt>).Let's take a look at a few examples,
1. Single Term and Description
<dl> <dd>Hyper Text Markup Language</dd>
<dd>Cascading Style Sheets</dd>
2. Single Term and Multiple Description
<dl>
<dt>HTML</dt> <dd>HyperText Markup Language.</dd>
<dd>Used to create Websites.</dd>
3. Multiple Terms and Single Description
<dd>is markup language</dd>
<dd>are programming languages.</dd>
HTML Line break
The HTML Line Break tag is used to apply a line break and start your text in the new line. Use the <br> br tag <br> to create line breaks in text.
Line-Break vs Multiple Paragraphs
As we know, an HTML paragraph always starts on a new line, instead of a line break we can
also use multiple paragraphs. For example,<p> to create line breaks in text.</p>
Example: Line breaks using HTML <br> and <p>
<p>Roses are red</p>
<p>Violets are blue</p>
<p>and so are You!</p>
Roses are red <br>
Violets are blue <br>
HTML is fun <br> and so are You!
HTML pre Tag
The HTML Preformatted text tag, <pre>, is used to define a block of text to display them in the
same manner as it is written in the HTML file. This Text will
Font in HTML <pre> tag
By default, the HTML <pre> tag changes the font of its content to a monospaced font. A
monospace font is a font in which all the characters occupy the same space.Code in HTML <pre> tag
The HTML <pre> tag is used to include code blocks in our HTML pages. For example,
<pre> let inviteFunction = async (invite) => {
let response = await fetch("/invite", {
let data = await response.json();
if (response.ok) return data;
throw new Error(data);
articles. It preserves the white spaces, making code more readable.If we use a <p> tag, the output would appear as below.
let inviteFunction = async (invite) => {
let response = await fetch("/invite", {
let data = await response.json();
if (response.ok) return data;
throw new Error(data);HTML Horizontal Line
The HTML Horizontal rule tag, <hr>, is used to insert a horizontal line between our paragraphs.
For example,HTML horizontal line to separate Page sections
The <hr> tag is used to apply a thematic break in HTML. i.e It is used when there is a change of
topic or you need to specify separation between content. Commonly, a <hr> tag is used between
sections in an article. For example,
behavior through space and time, and the related entities of energy and force. </p>
of elements and compounds, how they can change, and the energy that is released or absorbed
when they change.</p>
30You might also like