Skip to content

Commit

Permalink
Merge pull request #2214 from alphagov/no-underline-link-mixin
Browse files Browse the repository at this point in the history
Add no-underline mixin and modifier class
  • Loading branch information
36degrees authored Apr 30, 2021
2 parents 964604d + ff0f328 commit 57d6bb9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/views/examples/links/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
(<a class="govuk-link" href="#">Link with surrounding brackets</a>) test that the focus style does not overlap.
</p>

<p class="govuk-body">
<a class="govuk-link govuk-link--no-underline" href="#">Link with no underline</a>
</p>

{% for variant_description, variant_class in variants %}

<section class="govuk-!-margin-top-8">
Expand Down
4 changes: 4 additions & 0 deletions src/govuk/core/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
@include govuk-link-style-text;
}

.govuk-link--no-underline {
@include govuk-link-style-no-underline;
}

.govuk-link--no-visited-state {
@include govuk-link-style-no-visited-state;
}
Expand Down
13 changes: 13 additions & 0 deletions src/govuk/helpers/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@
}
}

/// No underline link mixin
///
/// Removes underlines from links (except on hover, or when the link is active).
/// This does not work in IE8, because IE8 does not support `:not`.
///
/// @access public

@mixin govuk-link-style-no-underline {
&:not(:hover):not(:active) {
text-decoration: none;
}
}

/// Print friendly link mixin
///
/// When printing, append the the destination URL to the link text, as long
Expand Down

0 comments on commit 57d6bb9

Please sign in to comment.