Html link new page
To create a link to a new page in HTML, you can use the <a>
tag with the href
attribute. The href
attribute specifies the URL of the page you want to link to.
Here is an example:
<a rel="nofollow" target="_blank" href="https://www.example.com">Visit Example.com</a>
This will create a link that says "Visit Example.com" and will take the user to the page at https://www.example.com
when clicked.
You can also use a relative URL, which is a URL that is relative to the current page. For example:
<a rel="nofollow" target="_blank" href="about.html">Visit the About page</a>
This will create a link that says "Visit the About page" and will take the user to the page at about.html
when clicked, assuming that about.html
is a file in the same directory as the current page.
You can also use the target
attribute to specify whether the linked page should be opened in the same window or a new window. For example:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Visit Example.com in a new window</a>
This will create a link that says "Visit Example.com in a new window" and will open the linked page in a new window when clicked.
Here are some common attributes you can use with the <a>
tag:
href
: specifies the URL of the linked pagetarget
: specifies whether the linked page should be opened in the same window or a new windowtitle
: specifies the text that appears when the user hovers over the linkrel
: specifies the relationship between the current page and the linked page (e.g. "nofollow" to indicate that the link should not be followed by search engines)hreflang
: specifies the language of the linked page
Here is an example of an <a>
tag with multiple attributes:
<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank" title="Visit Example.com" rel="nofollow" hreflang="en">Visit Example.com</a>
This will create a link that says "Visit Example.com", opens in a new window, has a title of "Visit Example.com", and is marked as "nofollow" to indicate that it should not be followed by search engines.