title


content

output
<dl>
   <dt>First item</dt>
   <dd>Second item</dd>
   <dt>Third item</dt>
   <dd>Fourth item</dd>
<dl>

abbreviations or Title


The WHO was founded in 1948.

address for the author/owner


Written by Mahmud Md Ashik
Visit me at: FB
Yunnan, Kunming
China

Attributes


href, src, alt, height, width, style

Spaces and Equal Signs

<!-- good -->
<link rel="stylesheet" href="styles.css">
<img src="../picture/imageMap.jpg" alt="imageMap" >

<!-- bad -->
<link rel = "stylesheet" href = "styles.css">
<img src = "../picture/imageMap.jpg" alt = "imageMap" >

audio


break


This is another
paragraph.

blockquote


Here is title

Here is content

Bi-Directional Override


This text will be written from right to left

This text will be written from right to left

block-level elements


Here are the block-level elements in HTML:

<address> <article> <aside>
<code> <blockquote> <dd>
<div> <dl> <dt>
<fieldset> <figcaption> <figure>
<footer> <form> <h1> <h6> <header> <hr>
<li> <main> <nav>
<noscript> <ol> <p>
<pre> <section> <table>
<tfoot> <ul> <video>

cite


The Scream

Tobu mone rekho by Shah Kamal Khan.

Colors


RGB values, HEX values, HSL values, RGBA values, and HSLA values.

Same as color name "Tomato":

rgb(255, 99, 71)

#ff6347

hsl(9, 100%, 64%)

Same as color name "Tomato", but 50% transparent:

rgba(255, 99, 71, 0.5)

hsla(9, 100%, 64%, 0.5)

comments


⟨!- -Write your comments here - - ⟩

CSS


Cascading Style Sheets (CSS) is used to format the layout of a webpage.

class


class

Code


HTML <code> For Computer Code

The HTML <code> element is used to define a piece of computer code. The content inside is displayed in the browser's default monospace font. Notice that <code> element does not preserve extra whitespace and line-breaks. To fix this, you can put the <code> element inside a <pre> element:

hello world

<!--For Computer Code-->

<code>
    <p> hello world </p>
</code>


<!--use pre-->

<pre>
    <code>
        hello world
    </code>
</pre>

HTML <kbd> For Keyboard Input

The HTML element is used to define keyboard input. The content inside is displayed in the browser's default monospace font.

Save the document by pressing Ctrl + S

<!--For Keyboard Input-->

<p> Save the document by pressing <kbd> Ctrl + S </kbd> </p>

HTML <samp> For Program Output

The HTML <samp> element is used to define sample output from a computer program. The content inside is displayed in the browser's default monospace font.

Hello World

<!--For Program Output-->

<p> <samp> Hello World </samp> </p>

HTML <var> For Variables

The HTML <var> element is used to define a variable in programming or in a mathematical expression. The content inside is typically displayed in italic.

x = 10;

<!--For Variables-->

<p> <var> x </var><code> = 10; </code> </p>

Character Sets


Characters

ASCII, ANSI, ISO-8859-1, UTF-8, Description

ASCII uses the values from 0 to 31 (and 127) for control characters. ASCII uses the values from 32 to 126 for letters, digits, and symbols. ASCII does not use the values from 128 to 255.

The ANSI Character Set (Windows-1252)

ANSI is identical to ASCII for the values from 0 to 127. ANSI has a proprietary set of characters for the values from 128 to 159. ANSI is identical to UTF-8 for the values from 160 to 255.

Number ASCII
33 &#33; !
34 &#34; "

Default Filenames


When a URL does not specify a filename at the end (like "https://www.w3schools.com/"), the server just adds a default filename, such as "index.html", "index.htm", "default.html", or "default.htm".

If your server is configured only with "index.html" as the default filename, your file must be named "index.html", and not "default.html".

Entities or character entity, Symbols


Reserved characters in HTML must be replaced with character entities. Entity names are case sensitive.

Description Entity Name Entity Number Output
les Then &lt; &#60; <
greater Then &gt; &#62; >
Non-breaking Space &nbsp;  
ampersand &amp; &#38; &
double quotation &quot; &#34; "
single quotation (apostrophe) &apos; &#39; '
cent &cent; &#162; ¢
pound &pound; &#163; £
yen &yen; &#165; ¥
euro &euro; &#8364;
copyright &copy; &#169; ©
registered trademark &reg; &#174; ®
LEFTWARDS ARROW &larr; &#8592;
UPWARDS ARROW &uarr; &#8593;
RIGHTWARDS ARROW &rarr; &#8594;
DOWNWARDS ARROW &darr; &#8595;
BLACK SPADE SUIT &spades; &#9824;
BLACK CLUB SUIT &clubs; &#9827;
BLACK HEART SUIT &hearts; &#9829;
BLACK DIAMOND SUIT &diams; &#9830;
link link

Combining Diacritical Marks

A diacritical mark is a "glyph" added to a letter. Some diacritical marks, like grave ( ̀) and acute ( ́) are called accents.

Construct Character Output
a&#768; a
c&#769; c
n&#770; n
o&#771; o

Symbols

Symbols that are not present on your keyboard can also be added by using entities.

Description Entity Name Entity Number Output
FOR ALL &forall; &#8704;
PARTIAL DIFFERENTIAL &part; &#8706;
THERE EXISTS &exist; &#8707;
EMPTY SETS &empty; &#8709;
NABLA &nabla; &#8711;
ELEMENT OF &isin; &#8712;
NOT AN ELEMENT OF &notin; &#8713;
CONTAINS AS MEMBER &ni; &#8715;
N-ARY PRODUCT &prod; &#8719;
N-ARY SUMMATION &sum; &#8719;

Using Emojis in HTML, 😀, 😍


Emojis are characters from the UTF-8 character set:

What are Emojis?

Emojis look like images, or icons, but they are not. They are letters (characters) from the UTF-8 (Unicode) character set.

The HTML charset Attribute

If not specified, UTF-8 is the default character set in HTML.

<meta charset ="UTF-8"

UTF-8 Characters

Characters UTF-8 Characters, ASCII Output
A &#65; A
B &#66; B
C &#67; C

Emoji Characters

To let the browser understand that you are displaying a character, you must start the entity number with &# and end it with ; (semicolon). Since Emojis are characters, they can be copied, displayed, and sized just like any other character in HTML.

Characters imoji
&#128512; 😀
&#128525; 😍
&#128151; 💗
link emojis

font-suze imoji
font-size: 40px; 😍
font-size: 50px; 😍
font-size: 60px; 😍

Figure and Figcaption


The <figure> tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.

The <figcaption> tag defines a caption for a <figure> element. The <figcaption> element can be placed as the first or as the last child of a <figure> element.

Trulli
Fig.1 - Tobu mone rekho
<figure>
    <img src ="./picture/tobu mone rekho.jpg" alt ="tobu mone rekho" >
    <figcaption> Fig.1 - Tobu mone rekho </figcaption>
</figure>

Forms


the default width of an input field is 20 characters.

Graphics


Canvas

SVG Graphics


SVG Graphics

SVG defines vector-based graphics in XML format.

SVG stands for Scalable Vector Graphics

HyperLinks, HTML links


text

A link does not have to be text. A link can be an image or any other HTML element!

.htm and .html?


There is no difference between the .htm and .html file extensions! Both will be treated as HTML by any web browser and web server.

Headings


Header 1

Header 2

Header 3

Header 4

header 5
Header 6

The Head Element


The HTML <head> element is a container for the following elements:

<title>, <style>, <meta>, <link>, <script>, and <base>

HTML metadata is data about the HTML document. Metadata is not displayed. Metadata typically define the document title, character set, styles, scripts, and other meta information.

title

The "title" element defines the title of the document. The title must be text-only, and it is shown in the browser's title bar or in the page's tab. The "title" element is required in HTML documents! The contents of a page title is very important for search engine optimization (SEO)! The page title is used by search engine algorithms to decide the order when listing pages in search results.

style

The "style" element is used to define style information for a single HTML page:

link

The "link" element defines the relationship between the current document and an external resource.

meta

The "meta" element is typically used to specify the character set, page description, keywords, author of the document, and viewport settings. The metadata will not be displayed on the page, but are used by browsers (how to display content or reload page), by search engines (keywords), and other web services.

Examples

                    Define the character set used:
<meta charset ="UTF-8" > Define keywords for search engines:
<meta name ="keywords"content ="HTML, CSS, JavaScript" > Define a description of your web page:
<meta name ="description"content ="Free Web tutorials" > Define the author of a page:
<meta name ="author"content ="Md Ashik Mahmud" > Refresh document every 30 seconds:
<meta http-equiv ="refresh"content ="30" > Setting the viewport to make your website look good on all devices:
<meta name ="viewport"content ="width=device-width, initial-scale=1.0" > The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.

Images   Image Map


W3Schools.com

The <img> tag is empty, it contains attributes only, and does not have a closing tag.


imageMap laptop mouse
                <img src ="../picture/imageMap.jpg" alt ="imageMap" usemap ="#testmap">
    
                <map name ="testmap">
                    <area shape ="rect" coords ="250, 264, 630, 607" href ="./laptop.html" alt ="laptop">
                    <area shape ="circle" coords ="740, 566, 38" href ="./mouse.html" alt ="mouse">
                    <area shape ="" coords ="" href ="" alt ="">
                </map>
                
Images    Image Map

Inline Elements


Here are the inline elements in HTML:

An inline element does not start on a new line. An inline element only takes up as much width as necessary. An inline element cannot contain a block-level element!

<a> <abbr> <acronym>
<b> <bdo> <big>
<br> <button> <cite>
<code> <dfn> <em>
<i> <img> <input> <label> <map> <object>
<output> <q> <samp>
<script> <select> <small>
<span> <strong> <sub>
<sup> <textarea> <time>
<tt> <var>

id attribute


The HTML id attribute is used to specify a unique id for an HTML element. You cannot have more than one element \ with the same id in an HTML document. the id attribute must be unique within the HTML document. The id name is case sensitive! The id name must contain at least one character, cannot start with a number, and must not contain whitespaces (spaces, tabs, etc.).

                        <script>
                            const x = document.getElementById("lion");
                            // x = lion 
                        </script>
<div id ="lion"> lion </div>

Iframe Syntax


The HTML <iframe> tag specifies an inline frame. An HTML iframe is used to display a web page within a web page.

<iframe src ="url" title ="description" height ="200" width ="300"> </iframe>

input


>
text:
password:
number:
email:
search:
tel:
url:
submit:
button:
reset
file:
date:
datetime-local:
month:
time:
week:
checkbox:
radio:
hidden:
image:
color:
range:
                
                

HTML Input Attributes

value,

value:
Readonly:
Disabled:
Size:
The default value for size is 20. The size attribute works with the following input types: text, search, tel, url, email, and password.
maxlength 4:
When a maxlength is set, the input field will not accept more than the specified number of characters. However, this attribute does not provide any feedback. So, if you want to alert the user, you must write JavaScript code.
min and max:

The min and max attributes work with the following input types: number, range, date, datetime-local, month, time and week.
Choose multiple files:
The multiple attribute works with the following input types: email, and file.
pattern:
The input pattern attribute specifies a regular expression that the input field's value is checked against, when the form is submitted. The pattern attribute works with the following input types: text, date, search, url, tel, email, and password. regular expressions
placeholder:
The placeholder attribute works with the following input types: text, search, url, tel, email, and password.
required:
The input required attribute specifies that an input field must be filled out before submitting the form. Works with: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file.
step:
if step="2", legal numbers could be -4, -2 0, 2, 4, etc. Works with: number, range, date, datetime-local, month, time and week.
Autofocus:
The input autofocus attribute specifies that an input field should automatically get focus when the page loads.
height and width:
list:
autocomplete:

java script


I am a student.

You are a student.

<body>
    <p id="my"> I am a student.</p>
    <p id="you"> You are a student.</p>


    <script>
        document.getElementById("you").innerHTML = "You are a teacher";
    </script>
</body>

k


content

Link


hyperlink

My FaceBook link

local link

Layout


HTML has several semantic elements that define the different parts of a web page:

                    
<header>
-Defines a header for a document or a section
<nav>
Defines a set of navigation links
<section>
- Defines a section in a document
<article>
- Defines an independent, self-contained content
<aside>
- Defines content aside from the content (like a sidebar)
<footer>
- Defines a footer for a document or a section
<details>
- Defines additional details that the user can open and close on demand
<summary>
- Defines a heading for the
element

Lists


An unordered HTML list:

  1. First item
  2. Second item
  3. Third item
  4. Fourth item

An ordered HTML list:

  • First item
  • Second item
  • Third item
  • Fourth item

Control List Counting

  1. first
  2. second
  1. first
  2. second
            <ol start ="50">
                <li>first<li>
                <li>second<li>
            </ol>
        
            <ol type ="I"start ="10">
                <li>first<li>
                <li>second<li>
            </ol>
            

Nested HTML Lists

  • Ashik
  • hobby
    • watching movie
    • Gaming
            <ul>
                <li>Ashik<li>
                <li>hobby
                    <ul>
                        <li>watching movie<li>
                        <li>Gaming<li>
                    <ul>
                <li>
            </ul>
            

A list item (< li >) can contain a new list, and other HTML elements, like images and links, etc.

name
- my name
            <dl>
                <dt>name<dt>
                <dd>- my name<dd>
            </dt>
            

Media


Multimedia on the web is sound, music, videos, movies, and animations. The MP4, WebM, and Ogg formats are supported by HTML.

n


abc

0


content

paragraph


This is a paragraph.

This is another paragraph.

picture


pre


                
                hello
                    world.
            

File Paths


A file path describes the location of a file in a web site's folder structure.

File paths are used when linking to external files, like
-Web pages
-Images
-Style sheets
-JavaScripts

Absolute File Paths

An absolute file path is the full URL to a file. such as: src="https://www.w3schools.com/images/picture.jpg"

Relative File Paths

A relative file path points to a file relative to the current page. such as: src="/images/picture.jpg"

Plug-ins


object

embed

q


content

Responsive Web Design


Responsive web design is about creating web pages that look good on all devices! A responsive web design will automatically adjust for different screen sizes and viewports.

Media Queries

In addition to resize text and images, it is also common to use media queries in responsive web pages. With media queries you can define completely different styles for different browser sizes.

resize the browser window:

left
center
right
/* Use a media query to add a break point at 800px: */
@media screen and (max-width: 850px) {
   .left, .main, .right {
       width: 100%; /* The width is 100%, when the viewport is 800px or smaller */
   }
}

Responsive Web Design - Frameworks

All popular CSS Frameworks offer responsive design. W3.CSS, Bootstrap

Styles


This is a heading

This is a paragraph.

Semantic Elements


Examples of non-semantic elements: <div> and <span> - Tells nothing about its content.

Examples of semantic elements: <form>, <table>, and <article> - Clearly defines its content.

<article> <aside> <details>
<figcaption> <figure> <header>
<footer> <main> <mark>
<nav> <section> <summary>
<time>

Style Guide


Close All HTML Elements

<p> paragraph </p>

Use Lowercase Attribute Names, Spaces and Equal Signs

HTML allows spaces around equal signs. But space-less is easier to read and groups entities better together.

<img href ="url" height ="200" width ="300">

Always Specify alt, width, and height for Images

<img href ="url" alt ="image" height ="200" width ="300">

Differences Between .htm and .html?

There is no difference between the .htm and .html file extensions! Both will be treated as HTML by any web browser and web server.

select


The

size

select multiple use ctl

The "datalist" element specifies a list of pre-defined options for an "input" element. Users will see a drop-down list of the pre-defined options as they input data. The list attribute of the "input" element, must refer to the id attribute of the "datalist" element.

Title or abbreviations


The WHO was founded in 1948.

Text Formatting Elements


Bold, Important, Italic, Emphasized, Marked, Smaller, Deleted, Inserted, Under, Subscript, Superscript, quote

This is Bold text

This is Important text

This is Italic text

I Emphasized text that

Marked text

This is the Smaller text of the paragraph

Discount: Deleted text

Inserted text Under line

Subscript text TEXT Superscript text

Here is quote

Table


Table

border-collapse: collapse;
Name Age Favorite
Ashik Mahmud 23 gardening
Esha Moni 10

u


content

Video


video

Youtube video

w


content

XHTML


What is XHTML?

  • XHTML stands for EXtensible HyperText Markup Language
  • XHTML is a stricter, more XML-based version of HTML
  • XHTML is HTML defined as an XML application
  • XHTML is supported by all major browsers

y


content

z


content