NEW POSTS
latest

Pages

Contact Form

Name

Email *

Message *

Showing posts with label HTML CODING. Show all posts
Showing posts with label HTML CODING. Show all posts

Base Tag in HTML

HTML <base> Tag

When building a website, you may need to link to several pages, images, documents, and other resources. Some of these links use complete web addresses, whereas others contain only a relative path. The HTML <base> tag helps manage these relative paths by defining a common starting URL for the entire document.

It can also specify where hyperlinks and form submissions should open by default. This means you can establish a default destination and browsing context without repeating the same information in every link.

The <base> element belongs inside the <head> section of an HTML document. It does not display anything on the webpage, but its settings influence how the browser handles URLs throughout the document.

Syntax of the HTML <base> Tag

The general syntax is:

<base href="URL" target="browsing-context">

The element has two main attributes: href and target. You can specify either one or use both in the same element.

Understanding the href Attribute

The href attribute establishes the base URL for resolving relative URLs in an HTML document. Whenever the browser encounters a relative path, it uses this address as the starting point to determine the complete destination.

For example, suppose you want the relative links on your website to use the following address as their starting point:

https://sey8.blogspot.com/

You can define it in the document's head section as follows:

<head>
    <base href="https://sey8.blogspot.com/">
</head>

Now consider these two elements:

<a href="tutorials/html-guide.html">HTML Guide</a>

<img src="images/html-cover.jpg" alt="HTML Guide Cover">

Because both paths are relative, the browser combines them with the base URL. Their resulting addresses are:

  • https://sey8.blogspot.com/tutorials/html-guide.html
  • https://sey8.blogspot.com/images/html-cover.jpg

These are illustrative paths. The corresponding pages and image must exist at those locations for the links and image to work.

Without a base URL, the browser would resolve relative paths against the URL of the current document. By defining a base URL, you can change the starting point used for those paths.

Relative URLs and Absolute URLs

It is important to understand the difference between relative and absolute URLs when using the <base> element.

A relative URL contains a path that the browser must resolve against a base address. For example:

pages/contact.html
images/logo.png
../documents/manual.pdf

An absolute URL provides a complete address, including the scheme and domain. For example:

https://www.wikipedia.org/
https://www.google.com/
https://sey8.blogspot.com/

The href attribute of the <base> element affects relative URLs. It does not replace an absolute URL with the base address.

For example, if your document contains the following link:

<a href="https://www.wikipedia.org/">Wikipedia</a>

The browser still opens Wikipedia, even if the document has this base URL:

<base href="https://sey8.blogspot.com/">

Understanding the target Attribute

The target attribute determines the default browsing context for hyperlinks and form submissions. In simpler terms, it controls where the browser opens a linked page or displays the result of a form submission.

For example, you can set the default target to a new browser tab:

<head>
    <base target="_blank">
</head>

After this setting, hyperlinks without their own target attribute will normally open in a new tab.

HTML provides four commonly used target keywords:

Target Value Purpose
_self Opens the destination in the current browsing context. This is the default behaviour.
_blank Opens the destination in a new browsing context, usually a new tab.
_parent Opens the destination in the parent frame. If no parent frame exists, it behaves like _self.
_top Opens the destination in the top-level browsing context, outside any frames.

You can also use a custom name as the target value. This allows multiple links to navigate to the same named browsing context.

Overriding the Default Target

The target specified in an individual hyperlink takes priority over the default target established by the <base> element.

Consider the following example:

<head>
    <base target="_blank">
</head>
<body>

    <a href="https://sey8.blogspot.com/">Visit My Blog</a>

    <a href="https://www.wikipedia.org/" target="_self">
        Visit Wikipedia
    </a>

</body>

The first link opens in a new tab because it follows the default target. The second link opens in the current tab because it explicitly specifies target="_self".

Using Both Attributes Together

You do not need separate <base> elements to define the default URL and target. Both attributes can be included in a single element.

For example:

<head>
    <base href="https://sey8.blogspot.com/" target="_blank">
</head>
<body>

    <a href="tutorials/css-guide.html">CSS Guide</a>

    <a href="tutorials/javascript-guide.html">JavaScript Guide</a>

</body>

In this example, both relative links use your blog's root URL as their starting point. They also open in new tabs because the default target is set to _blank.

The browser resolves the destinations as follows:

  • https://sey8.blogspot.com/tutorials/css-guide.html
  • https://sey8.blogspot.com/tutorials/javascript-guide.html

This approach can be useful when several links share the same base address and opening behaviour.

How the Base Tag Affects Other HTML Elements

The effect of the <base> element is not limited to hyperlinks. Its base URL is also used to resolve relative URLs in other elements that refer to external resources.

Here are some common examples:

  • Images: The src attribute of an <img> element.
  • Stylesheets: The href attribute of a <link> element.
  • JavaScript files: The src attribute of a <script> element.
  • Forms: The action attribute of a <form> element.
  • Other resources: URL references in elements such as <audio>, <video>, and <iframe>.

For example, suppose you have defined this base URL:

<base href="https://sey8.blogspot.com/">

The following image and stylesheet references will use that address:

<img src="media/banner.jpg" alt="Website Banner">

<link rel="stylesheet" href="styles/main.css">

The browser will look for the files at:

https://sey8.blogspot.com/media/banner.jpg

https://sey8.blogspot.com/styles/main.css

This behaviour can save you from writing the same domain and directory path repeatedly. However, you must make sure that the referenced files actually exist at the resulting locations.

Important Rules When Using the <base> Element

Although the <base> element is simple to use, there are a few important rules to follow.

  1. Only one base element is allowed. An HTML document must not contain more than one <base> element. If multiple elements are present, browsers use only the first applicable href and first applicable target values.
  2. It must be placed inside the head section. The <base> element belongs in the document's <head>, not in the <body>.
  3. At least one attribute is required. You must provide an href attribute, a target attribute, or both.
  4. Position matters. When the element has an href or target attribute, place it before other elements that use URL attributes or create hyperlinks, as applicable.
  5. It does not have a closing tag. The <base> element is a void element. Write it as a single tag rather than adding </base>.
  6. Individual targets can override the default. A hyperlink or form with its own target attribute uses that value instead of the default target.

How Does the Base Tag Affect Links to Sections on the Same Page?

One detail that developers sometimes overlook is how the <base> element handles fragment links. A fragment link normally points to a particular section of the current page using an element's id attribute.

For example:

<a href="#features">View Features</a>

<h2 id="features">Website Features</h2>

Under normal circumstances, clicking the link moves the browser to the section identified by features.

However, if you have specified a base URL, the browser resolves the fragment against that address. For example:

<base href="https://sey8.blogspot.com/">

With this setting, the link #features resolves to:

https://sey8.blogspot.com/#features

This may take the visitor to a different document or location rather than the section they expected to reach in the current page.

If your page uses a base URL and you want a link to point to a section of the current document, use the complete URL of that document followed by the fragment identifier.

Can the Base Tag Have a Relative URL?

Yes. The href attribute does not always need to contain a complete web address. It can also use a relative URL.

For example:

<base href="../resources/">

In this case, the browser resolves the base URL against the document's original URL. Other relative paths in the document are then resolved using the resulting base address.

However, an absolute URL is often easier to understand because it clearly identifies the website and directory that should serve as the starting point.

Also, the href attribute must not use the data: or javascript: URL schemes.

Does the <base> Tag Support Global Attributes and Events?

The <base> element supports HTML global attributes, which are attributes that can be used on most HTML elements.

However, it does not provide specific event handler attributes for handling user interactions. It is a metadata element and does not represent a visible or interactive part of the webpage.

It also has no default CSS appearance because it does not render visible content.

Browser Compatibility

The HTML <base> element is supported by all major modern web browsers, including:

  • Google Chrome
  • Mozilla Firefox
  • Microsoft Edge
  • Apple Safari
  • Opera

It is a well-established HTML feature and does not require JavaScript, CSS libraries, or any additional framework to work.

In Summary

The HTML <base> tag provides a convenient way to define the starting URL and default browsing context for an HTML document. Its href attribute controls how relative URLs are resolved, whereas its target attribute determines where links and form submissions open by default.

Although it can simplify URL management, you should use it carefully. A base URL can affect images, stylesheets, scripts, form destinations, and even links to sections within the same page. A small change to this element can therefore influence several parts of a website.

Once you understand how these two attributes work, you can decide when the <base> element is useful and avoid unexpected navigation or resource-loading problems in your HTML projects.

Audio Tag in HTML

HTML Audio Tag: How to Add Audio to a Web Page

Audio can make a website more useful and engaging. For example, you might want to add background music, a podcast, a recorded lesson, or a sound effect to a web page. HTML provides a built-in <audio> element that makes this possible without requiring an external plugin.

The HTML <audio> tag allows you to embed sound files directly into a web page. You can also give visitors playback controls, set an audio file to repeat, mute its sound, or control playback with JavaScript.

1. Basic HTML Audio Example

The simplest way to add audio to a web page is to use the <audio> element with the controls attribute. This attribute displays the browser's built-in audio player, which allows visitors to play, pause, adjust the volume, and control playback.

Example

<audio controls>
    <source src="audio.ogg" type="audio/ogg">
    Your browser does not support the audio element.
</audio>

Output

In this example, the controls attribute tells the browser to display its audio player. The source element specifies the location and format of the audio file. The text inside the audio element appears if the browser does not support audio playback.

2. Using the src Attribute

You can also specify the audio file directly through the src attribute of the <audio> element. This is a shorter alternative when you only need to provide one audio file.

Example

<audio src="audio.mp3" controls>
    Your browser does not support the audio element.
</audio>

Here, the src attribute specifies the audio file. The browser uses this file as the source for playback. This approach is convenient for a single audio format, but the <source> element is more flexible when you want to provide several formats.

3. Using the autoplay Attribute

The autoplay attribute tells the browser to start playing the audio automatically when the page loads and the audio is ready.

Example

<audio autoplay>
    <source src="audio.mp3" type="audio/mpeg">
</audio>

However, modern browsers often block autoplay when the audio contains sound. This restriction helps prevent websites from playing unexpected sounds as soon as visitors open a page. Autoplay may work when the audio is muted or when the visitor has interacted with the website.

4. Using the muted Attribute

The muted attribute makes the audio start with its sound turned off. Visitors can still use the playback controls to adjust the volume if controls are provided.

Example

<audio controls muted>
    <source src="audio.mp3" type="audio/mpeg">
</audio>

In this example, the audio player appears with the sound muted by default. This can be useful when you want to provide an audio file without immediately producing sound.

5. Using the loop Attribute

The loop attribute makes the audio play repeatedly. When the file reaches the end, the browser starts it again automatically.

Example

<audio controls loop>
    <source src="audio.mp3" type="audio/mpeg">
</audio>

This attribute is useful for background sounds, music, and other audio that should repeat continuously until the visitor stops playback.

6. Providing Multiple Audio Sources

Different browsers may support different audio formats. To improve compatibility, you can provide more than one audio source inside the same <audio> element.

Example

<audio controls>
    <source src="audio.mp3" type="audio/mpeg">
    <source src="audio.ogg" type="audio/ogg">
    <source src="audio.wav" type="audio/wav">
    Your browser does not support the audio element.
</audio>

The browser checks the listed sources and uses the first format it can play. If it cannot play the MP3 file, for example, it may try the OGG or WAV file instead.

Make sure that each source points to an actual audio file. The files should contain the same recording in different formats.

7. Using the HTML embed Element for Audio

HTML also provides the <embed> element, which can be used to include external multimedia content in a web page. It can display or play certain audio files, depending on browser support.

Example

<embed
    src="audio.ogg"
    type="audio/ogg"
    width="300"
    height="50">

The src attribute specifies the audio file, while type identifies its media format. The width and height attributes define the dimensions of the embedded content.

For ordinary audio playback, the <audio> element is generally the better choice because it provides dedicated audio features and more consistent browser support.

8. Controlling Audio with JavaScript

You can use JavaScript to control audio playback. For example, the play() and pause() methods allow you to start and stop an audio file through buttons on your web page.

Example

<audio id="myAudio">
    <source src="audio.mp3" type="audio/mpeg">
</audio>

<button onclick="playAudio()">Play</button>
<button onclick="pauseAudio()">Pause</button>

<script>
    const audio = document.getElementById("myAudio");

    function playAudio() {
        audio.play();
    }

    function pauseAudio() {
        audio.pause();
    }
</script>

In this example, JavaScript selects the audio element using its ID. When a visitor clicks the Play button, the playAudio() function starts playback. The Pause button calls pauseAudio() to stop the audio temporarily.

Common Attributes of the HTML audio Element

The following table lists some commonly used attributes of the HTML <audio> element.

Attribute Description
controls Displays the browser's built-in audio playback controls.
autoplay Attempts to play the audio automatically when it is ready.
muted Mutes the audio by default.
loop Repeats the audio automatically after it finishes.
preload Hints how much audio data the browser should load before playback.
src Specifies the location of the audio file.

Conclusion

The HTML <audio> element provides a simple way to add sound to a website. Its built-in attributes make it easy to display playback controls, repeat audio, mute sound, and attempt automatic playback. You can also provide multiple audio formats to improve compatibility or use JavaScript when you need more control over playback.

For most websites, the basic <audio controls> approach is a good starting point. It gives visitors control over playback and does not force sound to play as soon as they open the page.

CSS transform-style Property

Understanding the CSS transform-style Property

Rotating cards, spinning cubes, and layered scenes all rely on CSS 3D transforms. But applying a 3D transform to an element does not automatically make its nested elements behave like real 3D objects. Whether they do depends on a small property called transform-style. This article explains what it controls, how its two values differ, and why it is behind so many confusing 3D bugs. You can also experiment with everything in the live editor further down the page.



What is the transform-style Property?

Think of a transformed element as a sheet of glass and its children as stickers on that sheet. The transform-style property decides whether the children are treated as stickers that stay on the surface of the glass, or as separate objects that each keep their own depth in front of and behind it.

The sticker behavior is the default. If you rotate a child with rotateY() or push it forward with translateZ(), the browser still applies that transform, but the result is painted onto the parent's surface. The child can never sit in front of, behind, or through other elements in a shared 3D scene. Switching on the 3D behavior removes that limit.

Definition: transform-style is a CSS property that you set on a parent element to tell the browser how to render that element's children when 3D transforms are involved. With preserve-3d, the children keep their own positions in 3D space and share one scene with the parent. With flat, the children are drawn onto the parent's two-dimensional surface and lose their independent depth.

Core Property Values

The property accepts two keywords:

  • flat (Default): Children are drawn onto their parent's surface. Their own transforms still apply, but the parent is first rendered as a single flat picture, and only that picture takes part in the parent's rotation. Because every element starts this way, you rarely need to write transform-style: flat;, except to undo a preserve-3d declared by another rule.
  • preserve-3d: Children share a 3D scene with their parent. Each child keeps its own position and rotation in depth, so siblings can overlap correctly, intersect, or sit in front of and behind each other. Use it on any transformed element whose children must keep their depth, such as a card with two faces or a cube with six.

Note that preserve-3d is not needed to rotate a single element. A lone element can be turned with transform: rotateY(180deg) and no transform-style at all. The property only matters when an element has children that must keep their 3D relationship inside it.


Practical Example: 3D Card Container (Live Editor)

To see how this works in practice, consider a common card-flipping component. The editor below contains the HTML and CSS on the left and a live preview on the right. Hover over the card in the preview to flip it, and edit either code box to see the result instantly. Without preserve-3d on the rotating container, the two faces are flattened onto the container's plane instead of living in 3D space.

HTML Structure (editable)
CSS (editable)
Live Preview (hover to flip)

Things to Try in the Editor

  • Delete the transform-style: preserve-3d; line from .card. The browser falls back to flat, both faces are flattened onto the card's plane, and the back face (already turned 180 degrees) is drawn over the front face, so the flip effect is ruined.
  • Add overflow: hidden; or opacity: 0.9; to .card. This silently forces the used value back to flat and breaks the flip.
  • Remove perspective: 600px; from .scene. The rotation still happens, but it looks flat instead of having depth.
  • Remove backface-visibility: hidden; from .card-face. The face turned away from you now shows through as a mirrored image.

How perspective and transform-style Work Together

These two properties are often confused, but they do different jobs. perspective is set on a parent and gives its direct children a sense of depth: things closer to the viewer look larger. transform-style: preserve-3d keeps the deeper descendants in that same 3D space instead of flattening them. In the example, perspective on .scene creates the viewing distance for .card, and preserve-3d on .card lets the two faces inside it share that 3D space and be drawn with the same perspective. Without perspective, the rotation still happens but looks flat and orthographic; without preserve-3d, the faces collapse into a plane.

Why the Example Needs backface-visibility

The backface-visibility: hidden; rule is not part of transform-style, but the card flip depends on it. When the card turns, the front face ends up facing away from the viewer, and by default a face turned away is still drawn as a mirrored image. Hiding the back side of each face ensures that only the face currently pointing toward the viewer is visible.


Important Usage Considerations for Developers

  • Not Inherited: transform-style is not an inherited property. If you have deep nesting, you must declare transform-style: preserve-3d on every intermediate ancestor that sits between the 3D parent and the 3D content. The 3D chain breaks at the first ancestor that is flat: everything below that element is flattened onto its plane, no matter what its own children declare. This is one of the most common reasons a 3D scene "stops working" after an extra wrapper element is added.
  • Some Properties Force flat: Certain properties require an element to be rendered as a single flattened group, and they force the used value of transform-style back to flat even if you wrote preserve-3d. This behavior is deterministic, not occasional. Common triggers include:
    • overflow set to any value other than visible or clip (for example hidden, auto, or scroll)
    • opacity with a value less than 1
    • filter and backdrop-filter with a value other than none
    • clip with a value other than auto, and clip-path with a value other than none
    • mask properties such as mask-image with a value other than none
    • isolation: isolate
    • mix-blend-mode with a value other than normal
    • contain: paint, and anything that implies it, such as content-visibility: hidden
    For example, adding overflow: hidden or opacity: 0.9 to the .card element in the live editor above would silently flatten it and break the flip. If a 3D effect stops working, check the element and its ancestors for these properties first. To fade or clip a 3D object, apply those properties to a wrapper outside the 3D structure, or to the individual faces, instead of to the element that has preserve-3d.

Conclusion

The transform-style property is small, but it decides whether nested elements behave like real 3D objects or like paint on a flat surface. When a 3D layout misbehaves, check three things in order: is preserve-3d set on every element in the chain, is perspective applied on an ancestor, and does any element in the chain use a property that forces flat?

The transform-style property also supports standard global CSS values such as inherit, initial, revert, revert-layer, and unset.

Further Reading

For the formal definition and browser support details, see the MDN Web Docs page for transform-style.

Creating Superscript and Subscript in an HTML

HTML superscript and subscript

Result:

Superscript

5th December.

(a+b)2

Subscript

Nitric Acid, HNO3

Carbon dioxide, CO2

Splitting Or Merging Cells In An HTML Table Using An HTML Code

Splitting or merging cells in HTML table
-

Video Tutoral at https://youtu.be/bo4HN8R_lPY

1. Code Before Using rowspan & colspan:


2. Code after using rowspan & colspan:

3. Behind rowspan & colspan, Hiding Border Lines In An HTML Table By Using Background Color: 
remove table cellFull code:↓

How to Create a Table with Scrollbar Using HTML and CSS

Tables are crucial elements of any website as they are used to present and organize data in a structured manner. However, large tables with numerous rows and columns can often cause the web page to exceed its intended size and make it difficult for users to view the data. This is where a scrollbar becomes indispensable, enabling users to navigate through the table with ease and without having to resize their browser window.

table scrollbar

Try it at https://codepen.io/sirchogyal/pen/QWZaKpY

The first step in creating a table with a scrollbar is to create an HTML table. For our example, we will be using a table with five columns and five rows. Below is the HTML code for the table with a horizontal scrollbar using HTML and CSS and if you reduce the height, the vertical scrollbar from the right side will also appear. The table contains five columns: "SL No", "Particulars", "Quantity", "Unit Price", and "Total Amount (USD)". Each row of the table displays data related to an office furniture item, including the item number, description, quantity, unit price, and total amount in US dollars.

HTML Code

After creating the HTML table, we need to apply some CSS styles to add a scrollbar. The following is the CSS code for the scroll-bar class:

Stylesheet

The scroll-bar class contains CSS styles for the scrollbar. The height and width properties define the dimensions of the scrollbar container. The border property sets the border of the scrollbar container, while the font-family property sets the font family of the text inside the scrollbar container. The overflow property determines whether to clip the content or to add a scrollbar.

To add a horizontal scrollbar to the table, we can use the white-space property to prevent the text from wrapping and overflow-x property to add a horizontal scrollbar.

To add a vertical scrollbar, we can use the overflow-y property to add a vertical scrollbar to the scrollbar container. It's essential to set a height for the scrollbar container to ensure that the scrollbar appears.

With these simple steps, you can now create a table with a scrollbar using HTML and CSS. Experiment with different properties and styles to customize the scrollbar and the table to suit your requirements.

Adding a scrollbar to a table using HTML and CSS is an excellent way to present data in an organized and user-friendly way. With the code snippet provided in this blog post, you can easily create a table with a scrollbar and customize it to fit your specific needs. A scrollbar makes it easy for users to navigate through large tables, ensuring that your website remains easy to use and visually appealing.

How To Create and Link Favicon in HTML

Link favicon in HTML
-

"Fav" is the abbreviation for "favorite". A favicon, otherwise known as a shortcut icon, website icon, tab icon, URL icon, or bookmark icon, is a file containing one or more small icons that are associated with a particular website or web page. Or favicon is a small image or a logo of a website that shows before the title of a page on the browser's tab. It can also be shown when users bookmark your website or save it to their favorites.

You can design your logo and make it transparent where necessary. In my case, I used MS paint to design a simple logo and used Adobe Photoshop to remove background arround the logo and then saved as png file. After that, I google searched "image to favicon converter". Then picked an approprite website to convert image to favicon.

The following code demonstrates how the favicon can be linked. The favicon is added using a <link> tag as shown here in this line: <link rel="icon" type="image/x-icon" href="./images/favicon.ico">




The 'rel="icon"' attribute indicates that the linked resource serves as an icon. The link type is "image" or "x-icon" and this (href="./images/favicon.ico") serves as the path to the favicon file in the root directory.

This is how you can link favicon in html.

An Address Tag in HTML

Address Tag in HTML
-

Video Tutorial at: https://youtu.be/UpOKBVuweMg

Outlines

We know that HTML has many tags within the <html> tag and the <address> tag is one of them. Each tag carries a different usage and purpose which provides the overall structure, presentation, and functionality of a web page such as text formatting, styling, linking, etc.

Have you ever used an <address> tag? This tag is used to share contact information in an HTML document or on a website.

Definition of an <address> tag

So how do we define an <address> tag?

An <address> tag in HTML is used to define the contact information of an author/owner of a document/article/website. An address element can be a physical address, phone number, link, social media ID, etc. which can be used as contact information. The text inside the <address> element will be rendered in italics. There will be a line break which is equivalent to one <br> tag before and after the <address> element.

Where to use <address> tag

The <address> tag is straightforward and easy to learn. The only thing you need to remember is that whenever you show an address on your web document, make sure your contact information is written within the <address> tag. This will help you improve the structure of your website and may contribute toward a better SEO ranking.

You can keep your contact information or the information about an author or anyone in any part of your web document. It can be at the footer, inside/above/below an article, on a separate page, etc.

Example of an <address> tag:
     <address>
           Edited by: John Bennet
           From: Washington, D.C.
     </address>

The CSS of an <address> tag can be written as shown in the <style> tag below:



The <address> tag can also support the Global Attributes & Event Attributes in HTML.

Summary

An <address> tag is a simple tag just like any other tags used in HTML and it is used to provide contact information or information of an author/owner for a particular web(HTML) document or documents. It can be used in any part of the HTML. So remember to use the <address> tag whenever you share contact information. I do hope my readers will love this simple blog post. Goodbye for now. Until next time!

hr and br tags in HTML

hr and br tags
-

Video Tutoral at https://youtu.be/B1UCE3nfLww

The <hr> tag defines a horizontal rule or thematic break in an HTML page. It shows as a horizontal line. It is used to divide or separate content or a change of topic, chapter, section, etc. It doesn't require an end tag.

The <br> tag is an empty tag used to break a line in HTML text. Like the <hr> tag, the <br> tag has no end tag. According to my online research, I learned that it is generally used in poems and addresses. Despite poems and addresses, I found that the <br> tag is also used in other topics.

The <hr> and <br> tags can be also written as <hr/> and <br/> respectively.

HTML

A Doctype Declaration in HTML

A Doctype Declaration or Document Type Declaration (DTD): This declaration is always made before the <html> tag. We know that HTML documents are written inside the <html> tag. A <!DOCTYPE> declaration must be written before the HTML documents. This declaration is not an HTML tag but an information to the browser about type of document being used by a website. So to specify the version of HTML, the DTD is used in an HTML document.

-

Video Tutoral at https://youtu.be/7_0N7p3KmvU

1. DTD in HTML 4.01:

For example, in the past, this declaration (<!DOCTYPE html PUBLIC "-//CodeAtHome//DTD HTML 4.01 Transitional//EN" "http://www.c815.blogspot.com/html4.dtd">) was made to ensure the browser that the website was using HTML 4.01 as shown below.


2. DTD in HTML 5:

In HTML 5, the <!DOCTYPE> Declaration has much more simplified. It can be written as <!DOCTYPE html> as shown below. Modern web browsers support HTML5. So it is very feasible to use the <!DOCTYPE html> declaration on every website.

US Flag
play button