Professional Documents
Culture Documents
Basics of HTML
Basics of HTML
<h1>The b element</h1>
</body>
</html>
The title attribute defines some extra information about an element.
The value of the title attribute will be displayed as a tooltip when you mouse
over the element:
HTML Editors
HTML Page Structure
HTML Basic Tags
Background
A paragraph always starts on a new line, and browsers automatically add some white
space (a margin) before and after a paragraph.
HTML <hr> tag
HTML <hr> tag is used to specify a paragraph-level thematic break in HTML
document. It is used when you abruptly change your topic in your HTML document. It
draw a horizontal line between them. It is also called a Horizontal Rule in HTML.
Presentational Elements
• Bold
• Italic
• Underline
• Subscripted
• Superscripted
• Strike through
• Emphasized
• Strong
• Inserted
• Deleted
Presentational Elements
Presentational Elements
<html>
<head>
<title>Presentational element</title>
</head>
<body>
<p><b>this text is bold</b></p>
<p><i>this text is italic</i></p>
<p><u>this text is underline</u></p>
<p>Written on the 31<sup>st</sup> February.</p>
<p>The EPR paradox<sub>2</sub> was devised by Einstein, Podolsky, and Rosen.</p>
<p><strike>this text is strikethrough</strike></p>
<p><s>this text is strikethrough</s></p>
<p><em>this text is emphasis</em></p>
<p><strong>this text is strong</strong></p>
<p>My favorite color is <del>blue</del> <ins>red</ins>!</p>
</body>
<html>
Phrase Elements
Text Direction
The <bdo>...</bdo> element stands for Bi-Directional Override and it is used to
override the current text direction.
<html>
<head>
<title>Text Direction Example</title>
</head>
<body>
<p>This text will go left to right.</p>
<p><bdo dir = "rtl">This text will go right to left.</bdo>
</p>
</body>
</html>
<html>
<head>
<title>Double Quote Example</title>
</head>
<body>
<p>Amit is in Spain, <q>I think I am wrong</q>.</p>
</body>
</html>
<html>
<head>
<title>Citations Example</title>
</head>
<body>
<p>This HTML tutorial is derived from <cite>W3 Standard for HTML</cite>.</p>
</body>
</html>
• Computer code
• Keyboard
• Variable
• Preformatted
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.
Computer Code
Notice that the <code> element does not preserve extra whitespace and line-breaks.
To fix this, you can put the <code> element inside a <pre> element:
Keyboard Element
<kbd> element in HTML
The <kbd> tag is used to define the keyboard input. Use this when you want the user to
type on their keyboard, for example, shortcut keys Ctrl+C for copy, Esc for exit, etc.
<html>
<body>
<h2>Shortcut Keys</h2>
<p>Use the following shortcut keys −</p>
<p><strong>Cut</strong> :<kbd>CTRL</kbd>+<KBD>X</kbd></p>
<p><strong>Copy</strong> : <kbd>CTRL</kbd>+<KBD>C</kbd></p>
<p><strong>Paste</strong> :<kbd>CTRL</kbd>+<KBD>V</kbd></p>
<p><strong>Undo</strong> : <kbd>CTRL</kbd>+<KBD>Z</kbd></p>
</body>
</html>
Variable
<var> element in HTML
The <var> element in HTML is used to display mathematical expression for calculations.
<html>
<body>
<h2>Mathematical Equation</h2>
Sample equation :<var>2x</var> - <var>2z</var> = <var>3y</var> + 9
</body>
</html>
Preformatted
<pre> element in HTML
The <pre> tag in HTML is used to set preformatted text. The text in it preserved spaces
and line breaks i.e. the text appears the same in the web page as it is added under the
HTML code.
<html>
<body>
<h2>Demo Heading</h2>
<pre>
This is a demo text
and will appear
in the same format as
it
is visible
here. The pre tag displays
the text in a fixed-width
font. It preserves
both spaces and
line breaks as you can see
here.
</pre>
</body>
Linking to E - mail Addresses
• You ’ ve probably seen a link that shows an e -
mail address, which when clicked on opens a new
e - mail in your e - mail program, ready for you to
send an e - mail to that address.
• To create a link to an e - mail address, you need
to use the following syntax with the < a >
element:
< a href=”mailto:name@example.com” > send email < /a >
<!DOCTYPE html>
<html>
<body>
<p>To create a link that opens in the user's email program (to let them send a
new email), use mailto: inside the href attribute:</p>
<p> <a href="mailto:karthikr@shctpt.edu">Send email</a></p>
</body>
</html>
Output
To create a link that opens in the user's email program (to let them send a new email),
use mailto: inside the href attribute:
Send email
HTML Links - The target Attribute
<p>If target="_blank", the link will open in a new browser window or tab.</p>
</body>
</html>
Visit W3Schools!
To use an image as a link, just put the <img> tag Inside the <a> tag:
<!DOCTYPE html>
<html>
<body>
<h2>Image as a Link</h2>
<a href="https://shctpt.edu">
<img src="smiley.gif" alt=“SHC web site" style="width:42px;height:42px;">
</a>
</body>
</html>
Thank You