You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -765,3 +863,120 @@ This is an anchor to a section in the webpage returned by the web server. This i
765
863
</span>
766
864
767
865
---
866
+
867
+
# Links
868
+
869
+
---
870
+
871
+
## Links
872
+
873
+
<spanclass="center wide">
874
+
875
+
In HTML, links are created with the Anchor tag (`a`) and have an `href` attribute with the URL we would like to link to.
876
+
877
+
</span>
878
+
879
+
<hr />
880
+
881
+
```html
882
+
<ahref="https://google.com">Click here to go to Google.com</a>
883
+
```
884
+
885
+
---
886
+
887
+
## Href attribute
888
+
889
+
You can use any valid URL in the `href` attribute.
890
+
891
+
<hr />
892
+
893
+
```html
894
+
<ahref="https://www.google.com/search?q=Python">Click here to go to search for "Python"</a>
895
+
```
896
+
897
+
---
898
+
899
+
## Absolute URLs
900
+
901
+
<spanclass="center wide">
902
+
903
+
When a URL includes all of the usual parts (scheme, domain, port, path, etc.), it is referred to as an _absolute URL_.
904
+
905
+
</span>
906
+
907
+
<hr />
908
+
909
+
`https://www.google.com/search?q=Python`
910
+
911
+
---
912
+
913
+
## Relative URLs
914
+
915
+
<spanclass="center">
916
+
917
+
URLs that only include the path, query, and anchor are referred to as _relative URLs_.
918
+
919
+
</span>
920
+
921
+
<hr />
922
+
923
+
`/search?q=Python`
924
+
925
+
---
926
+
927
+
## Relative URLs
928
+
929
+
`/search?q=Python`
930
+
931
+
<hr />
932
+
933
+
<spanclass="centered">
934
+
<imgsrc="assets/mdn-url-all.png" />
935
+
</span>
936
+
937
+
---
938
+
939
+
## Relative URLs
940
+
941
+
<spanclass="center wide">
942
+
943
+
The parts of a relative URL that are left out (like the domain), are taken from the existing webpage that you are on.
944
+
945
+
</span>
946
+
947
+
---
948
+
949
+
## Relative URLs
950
+
951
+
<spanclass="center">
952
+
953
+
This means that when you are on `https://google.com`, when a user clicks on a link for `/search?q=Python` they will be taken to `https://google.com/search?q=Python`.
0 commit comments