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
Copy file name to clipboardExpand all lines: docs/content/components/links.md
+23-8Lines changed: 23 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,39 +10,42 @@ bundle: links
10
10
Please note Primer v16 has changed the naming of these color classes. Check the <ahref="/css/support/v16-migration">migration guide</a> to make sure your app is up to date.
11
11
</Note>
12
12
13
-
By default `<a>` elements already use the right link color and apply an underline on hover.
13
+
By default `<a>` elements already use the right link color and apply an underline on hover. So in most cases the `.Link` class is not really needed.
14
14
15
15
```html live
16
-
Some text with a default <ahref="#url">link</a>
17
-
```
18
-
19
-
If you need to make other elements behave like a link and perhaps use JS to trigger navigating to another page, use the `.Link` class.
20
-
21
-
```html live
22
-
Some text with a <spanclass="Link">span that behaves like a link</span>
16
+
Some text with a <ahref="#url">link</a>
17
+
Some text with a <ahref="#url"class="Link">link</a>
23
18
```
24
19
25
20
If you like to override the default link styles you can do so with the following link utilities. **Bear in mind that link styles are easier for more people to see and interact with when the changes in styles do not rely on color alone.**
26
21
22
+
## Primary link
23
+
27
24
Use `.Link--primary` to turn the link color to blue only on hover.
28
25
29
26
```html live
30
27
<pclass="color-text-secondary">Some text with a <aclass="Link--primary"href="#url">Link--primary</a></p>
31
28
```
32
29
30
+
## Secondary link
31
+
33
32
Use `.Link--secondary` for a more subtle link color that turns blue on hover.
34
33
35
34
```html live
36
35
Some text with a <aclass="Link--secondary"href="#url">Link--secondary</a>
37
36
```
38
37
38
+
## Muted link
39
+
39
40
Use `.Link--muted` also removes the underline on hover. Tip: You can also use the `.no-underline` utility to do the same for `.Link--primary`.
40
41
41
42
```html live
42
43
<p>Some text with a <aclass="Link--secondary no-underline"href="#url">Link--muted</a></p>
43
44
<p>Some text with a <aclass="Link--primary no-underline"href="#url">Link--primary no-underline</a></p>
44
45
```
45
46
47
+
## On hover link
48
+
46
49
Use `.Link--onHover` to make any text color used with links to turn blue on hover. This is useful when you want only part of a link to turn blue on hover.
47
50
48
51
```html live
@@ -51,6 +54,18 @@ Use `.Link--onHover` to make any text color used with links to turn blue on hove
51
54
</a>
52
55
```
53
56
57
+
## Nested link
58
+
59
+
The `.Link` class can be nested inside an `<a>` element if only part of it should be styled like a link.
Link classes in combination with [color utilities](../utilities/colors) lets you colorize information separately inside of a link but have all of the link turn into one color on hover.
0 commit comments