MyBlogHelp– A Blog for Digital Marketing, Affiliate Marketing, Organic Lead Generation.
  • Home
  • About
  • Contact
  • Privacy
  • Sitemap
  • BLOG
  • AFFILIATE MARKETING
    • LeadsArk
  • MORE
    • MAKE MONEY
      • ONLINE BUSINESS
      • ADSENSE
      • AFFILIATE MARKETING
    • BLOGGING
      • SEO
      • BlogSpot
      • WORPRESS
      • GOOGLE
      • COMPUTER TIPS
    • WEB DESIGN
      • HTML
      • CSS
      • BOOTSTRAP
      • JAVASCRIPT
      • JQUERY
    • WEB DESIGN
      • HTML
      • CSS
      • BOOTSTRAP
      • JAVASCRIPT
      • JQUERY
    • WEB DEVELOPMENT
      • PHP
      • WORDPRESS
  • DOWNLOADS
    • Blogger Template
    • Wordpress Theme
    • PDF

Saturday, December 15, 2018

How to use base tag in HTML?

 MyBlogHelp     December 15, 2018     html     No comments   

base-tag-in-html
BASE-TAG-IN-HTML

<base> Tag in HTML

1. Introduction to  <base> tag in HTML.
2. Syntax of <base> tag in HTML.
3. Attributes of <base> tag in HTML.

Introduction of <base> Tag in HTML

The HTML <base> tag specifies the base URL for all the URLs in an HTML document. After this, you don't need to enter the full URL. Whenever you add a URL, the base URL is automatically prefixed before that URL.

For example, suppose your images are in the webImage/images directory, which address C:/Users/AYAN/Desktop/documents/web-images/images. Whenever you add an image, you have to define the full address as below.

    <img src = C:/Users/AYAN/Desktop/documents/webImage/images/showcase.jpg">

Similarly, for all of the images you want to add, you will have to specify the full address. But if you define the address of the web-files directory as a base URL, then you will not have to type the full URL to add images. You can see as below.

                   <img src = "showcase.jpg">

All the links specified in the document will be related to the base URL. Base URL is defined at the top of the page and you can use the rest of the links in short forms.

The code is reduced in the document by using the <base> tag. It also makes the code easier to understand.

The main drawback of the <base> tag is that once you define it you are bounded because all links before it automatically get prefix. It is not possible to do so if you want to add an image or file from another location.

The <base> tag is also included in HTML5. By this, you define the base URL for all the URLs and you can also set the target for all the links.

How to use the base tag in HTML?

Syntax of <base> Tag in HTML

The general syntax of the lower <base> tag is given as below.

                            <base href = "base-url" target = "_ blank">

It is necessary to define either a href or the target attribute in a <base> tag. <base> can’t be defined without the attribute.

There is no end tag of the <base> tag in HTML. This is an empty tag. But if you are using it in XHTML, it must be closed by the </ base> end tag.

The <base> tag should be only defined once in the entire document. It should always be defined within the <head> tag.

Attributes of <base> Tag in HTML

              There are two attributes available with <base> tag. These are described as below.

href

   This attribute specifies the base URL. The URL is written in double quotes.

target

   By this attribute, you can define the target of links. The values of this attribute can be defined as below.

   _blank 

     When you want to open the link in a new window, you will have to define target as "_blank". 

_self

    When you want to open the link in the current window, you will have to define target as "_self".

_parent 

  When you want to open the link in the parent container, the target should be "_parent".

HTML also supports global and event attributes in <base> tag.

Example of HTML <base> Tag which is given as below.



This script generates the given output as below.


base-tag-in html
HTML-BASE-TAG






  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Thank you for reading this post. Please do not enter any spam link in the comment box.

Followers

Blog Archive

  • ►  2020 (4)
    • ►  October (1)
    • ►  September (1)
    • ►  August (2)
  • ►  2019 (52)
    • ►  December (1)
    • ►  November (2)
    • ►  October (1)
    • ►  August (1)
    • ►  July (1)
    • ►  May (11)
    • ►  April (10)
    • ►  March (6)
    • ►  February (3)
    • ►  January (16)
  • ▼  2018 (54)
    • ▼  December (27)
      • How to use html5 nav tag?
      • How to install Google Fonts on your Blogger Blog?
      • How to use section tag in html5?
      • How to use meter tag in html5?
      • How to use time tag in html5?
      • How to use header tag in HTML5?
      • How to use figure tag in html5?
      • How to use aside tag in html5?
      • How to use details Tag in HTML5?
      • How to use wbr tag in html5?
      • How to use article tag in HTML 5 ?
      • How to use menu tag in html?
      • How to use base tag in HTML?
      • How to use HTML hr and br Tag?
      • How to use HTML address tag?
      • How to use HTML Meta Tags?
      • How to use HTML script & noscript Tag?
      • How to use DOCTYPE declaration in HTML?
      • How to use Form Tag in HTML?
      • How to use Block and Inline Tags in HTML?
      • How to use Lists in HTML?
      • How to use Image Tag in HTML?
      • How to use Table Tag in HTML?
      • How to use anchor Tag in HTML?
      • How to Format & Style in HTML?
      • How to use Heading in HTML?
      • What is Attribute in HTML?
    • ►  November (5)
    • ►  May (5)
    • ►  April (4)
    • ►  February (3)
    • ►  January (10)
  • ►  2017 (17)
    • ►  December (9)
    • ►  November (8)

Popular Posts

  • How to use the main tag in html5?
  • How to use keygen tag in html5?
  • How to use html5 mark tag to highlight text?
  • How to start Online Business without money from home?
  • What is a search engine?

Contact Us

Name

Email *

Message *

About MyBlogHelp

Most of the posts, we share on this blog related to Affiliate Marketing, Organic Lead Generation, Digital Marketing, Social Media Marketing, Make Money Online, SEO, and web design.

Featured Post

LeadArk - Affiliate Marketing | Qualified Organic Lead Generation | LeadsArk Review

Copyright © MyBlogHelp– A Blog for Digital Marketing, Affiliate Marketing, Organic Lead Generation.
Design by Md. Abdussamad | MyBlogHelp.com