Internal and External Links in HTML
Learn to create links to other websites and to sections within the same page using different `href` values.
Internal vs. External Links
HTML links can point to other websites or to different sections of the very same page. Let's learn the difference between external and internal links!
External Links
External links use a complete, absolute URL in the href
attribute to direct users to a different website. It's best practice to have these open in a new tab using target="_blank"
.
Internal Links (Anchors)
Internal links use a hash (`#`) followed by the `id` of an element on the same page. For example, <a href="#contact">
will jump to the element with <div id="contact">
.
Practice Zone
Interactive Test 1: Drag & Drop
Arrastra en el orden correspondiente.
Arrastra las opciones:
Completa el código:
Interactive Test 2: Fill in the Blanks
Rellena los huecos en cada casilla.
<a >Go to Section 1</a> <div >Content</div>
Practice Example: Code Editor
Create an external link to `https://www.google.com` and an internal link to a section with the id `contact`.