2 HTML tags that you didn't know y#60;base> and <abbr>

- Andrés Cruz

En español

2 HTML tags that you didn't know y#60;base> and <abbr>

In the HTML API there are many tags or elements that are rarely used because they have very specific functions and therefore are not as famous but are still useful; today we will look at a couple of HTML tags that you may not know:

The element <base>

This element defines a URL and/or global target for the document that allows overwriting the target and/or href attributes that are not specified in an <a> element.

IMPORTANT! There can only be one <base> element in the document head:

If we have the following HTML code:

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Elemento base 1</title>
            <base href="https://www.bing.com/" target="_blank">
        </head>

        <body>
            <a href="">Google.com</a>
        </body>
    </html>

We will see that by clicking on the "Google.com" link it will redirect us to the Microsoft search engine at the following address: https://www.bing.com/.

Example

If, on the other hand, we specify the URL in the href attribute of the link:

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Elemento base 2</title>
            <base href="https://www.bing.com/" target="_blank">
        </head>

        <body>
            <a href="http://www.google.com/">Google.com</a>
        </body>
    </html>

The link will redirect us to Google.com, although not specifying the target will open the link in a new tab.

Example

The element <abbr>

This element simply allows you to define an abbreviation as we can see in the following example:

<p>El lenguaje de programación <abbr title="PHP Hypertext Pre-processor">PHP</abbr>...</p>

El lenguaje de programación PHP...

El lenguaje de programación PHP...

Consult the official documentation at the following links:

Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.