HTML LINKS
HTML links are connected from one webpage or web resource to another. By clicking a hyperlink you jump to another webpage or web resource.
We generally use hypertext (Hypertext is a text within hyperlink) to be clicked upon to go to a new web page.
Note : It is not necessary that a link can only have text. It may be an image, Button or other HTML element too.
HTML link Syntax:
We use < a >tag to define hyperlink. < a >tag is known as Anchor tag:
- href is attribute of anchor tag and is used to give destination of link
- Content in between opening and closing of < a >tag is clickable and visible part of hyperlink
Apart from href attribute there are other attributes too.
Like:
Let’s discuss these attributes.
HTML Link — Target Attribute
target attribute is used to specify where the linked document should be opened. Whether it will open in the same tab or on a different tab.
This attribute has following values:
- _self — It opens the linked document to the same tab.It’s also default value.
- _blank — It opens the linked document to a different tab or window.
- _parent — It opens the linked document in the parent frame.
- _top — It will open the linked document in the full body of the window.
Here is an example and you can change different values to see the difference in the practice section.
HTML Link — title attribute
title attribute provides additional information about HTML link.When user takes its cursor over the link then value provided for title attribute is shown in a box.
Image as Hyperlink
As mentioned above we can use image also as HTML link.Here is an example:
This image is to go to Homepage
HTML Link — Bookmark
You can also use HTML links to create bookmarks on the same web page. Clicking on the link will instantly take you to that part of the web page.
Here is an example that will take you to HTML link syntax.
click here to jump to HTML link syntax.
Here is how to create a web page bookmark.
- First create an id to the part of the web page where you want to jump.
Атрибут title
Добавляет поясняющий текст к ссылке в виде всплывающей подсказки. Такая подсказка отображается, когда курсор мыши задерживается на ссылке.
Синтаксис
Обязательный атрибут
Значения
Любая текстовая строка. Строка должна заключаться в двойные или одинарные кавычки.
Значение по умолчанию
Рисунки
Не выкладывайте свой код напрямую в комментариях, он отображается некорректно. Воспользуйтесь сервисом cssdeck.com или jsfiddle.net, сохраните код и в комментариях дайте на него ссылку. Так и результат сразу увидят.
Типы тегов
HTML5
Блочные элементы
Строчные элементы
Универсальные элементы
Нестандартные теги
Осуждаемые теги
Видео
Документ
Звук
Изображения
Объекты
Скрипты
Списки
Ссылки
Таблицы
Текст
Форматирование
Формы
Фреймы