mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-17 14:54:30 +01:00
Icon link: envariable + enhance the documentation (#38130)
* Envariable the icon-link helper * Proposal * .
This commit is contained in:
parent
912cfe5823
commit
783213691a
@ -459,6 +459,15 @@ $link-hover-decoration: null !default;
|
|||||||
$stretched-link-pseudo-element: after !default;
|
$stretched-link-pseudo-element: after !default;
|
||||||
$stretched-link-z-index: 1 !default;
|
$stretched-link-z-index: 1 !default;
|
||||||
|
|
||||||
|
// Icon links
|
||||||
|
// scss-docs-start icon-link-variables
|
||||||
|
$icon-link-gap: .375rem !default;
|
||||||
|
$icon-link-underline-offset: .25em !default;
|
||||||
|
$icon-link-icon-size: 1em !default;
|
||||||
|
$icon-link-icon-transition: .2s ease-in-out transform !default;
|
||||||
|
$icon-link-icon-transform: translate3d(.25em, 0, 0) !default;
|
||||||
|
// scss-docs-end icon-link-variables
|
||||||
|
|
||||||
// Paragraphs
|
// Paragraphs
|
||||||
//
|
//
|
||||||
// Style p element.
|
// Style p element.
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
.icon-link {
|
.icon-link {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
gap: .375rem;
|
gap: $icon-link-gap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-decoration-color: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-opacity, .5));
|
text-decoration-color: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-opacity, .5));
|
||||||
text-underline-offset: .25em;
|
text-underline-offset: $icon-link-underline-offset;
|
||||||
backface-visibility: hidden;
|
backface-visibility: hidden;
|
||||||
|
|
||||||
> .bi {
|
> .bi {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 1em;
|
width: $icon-link-icon-size;
|
||||||
height: 1em;
|
height: $icon-link-icon-size;
|
||||||
@include transition(.2s ease-in-out transform);
|
fill: currentcolor;
|
||||||
|
@include transition($icon-link-icon-transition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +19,7 @@
|
|||||||
&:hover,
|
&:hover,
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
> .bi {
|
> .bi {
|
||||||
transform: var(--#{$prefix}icon-link-transform, translate3d(.25em, 0, 0));
|
transform: var(--#{$prefix}icon-link-transform, $icon-link-icon-transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,14 @@ Add `.icon-link-hover` to move the icon to the right on hover.
|
|||||||
</a>
|
</a>
|
||||||
{{< /example >}}
|
{{< /example >}}
|
||||||
|
|
||||||
|
## Customize
|
||||||
|
|
||||||
|
Modify the styling of an icon link with our link CSS variables, Sass variables, utilities, or custom styles.
|
||||||
|
|
||||||
|
### CSS variables
|
||||||
|
|
||||||
|
Modify the `--bs-link-*` and `--bs-icon-link-*` CSS variables as needed to change the default appearance.
|
||||||
|
|
||||||
Customize the hover `transform` by overriding the `--bs-icon-link-transform` CSS variable:
|
Customize the hover `transform` by overriding the `--bs-icon-link-transform` CSS variable:
|
||||||
|
|
||||||
{{< example >}}
|
{{< example >}}
|
||||||
@ -54,7 +62,22 @@ Customize the hover `transform` by overriding the `--bs-icon-link-transform` CSS
|
|||||||
</a>
|
</a>
|
||||||
{{< /example >}}
|
{{< /example >}}
|
||||||
|
|
||||||
## Pairs with link utilities
|
Customize the color by overriding the `--bs-link-*` CSS variable:
|
||||||
|
|
||||||
|
{{< example >}}
|
||||||
|
<a class="icon-link icon-link-hover" style="--bs-link-hover-color-rgb: 25, 135, 84;" href="#">
|
||||||
|
Icon link
|
||||||
|
<svg class="bi" aria-hidden="true"><use xlink:href="#arrow-right"></use></svg>
|
||||||
|
</a>
|
||||||
|
{{< /example >}}
|
||||||
|
|
||||||
|
### Sass
|
||||||
|
|
||||||
|
Customize the icon link Sass variables to modify all icon link styles across your Bootstrap-powered project.
|
||||||
|
|
||||||
|
{{< scss-docs name="icon-link-variables" file="scss/_variables.scss" >}}
|
||||||
|
|
||||||
|
### Utilities
|
||||||
|
|
||||||
Modify icon links with any of [our link utilities]({{< docsref "/utilities/link/" >}}) for modifying underline color and offset.
|
Modify icon links with any of [our link utilities]({{< docsref "/utilities/link/" >}}) for modifying underline color and offset.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user