Skip to content

Commit

Permalink
Improve styling on selected links
Browse files Browse the repository at this point in the history
This commit makes several improvements to selected links:

* Previously, the link selection style had both the -moz prefixed
  selector and the unprefixed selector in the same rule, breaking the
  rule for browsers that did not know about the -moz prefix (such as
  Chrome). This is fixed by removing the -moz prefixed version, since it
  is not needed on modern browsers.
* Previously, the background color was set to #b4d5fe, but this is not
  the correct selection color for all platforms. This is fixed by using
  the "highlight" and "highlighttext" colors, to ensure that link
  selections look the same as the surrounding text.
* Selection fixes are now applied to markup in links, as well as text in
  links - for instance, italicised or bolded links will look normal now.

This has been tested in Firefox and Chrome on Linux, and offers
improvements on both (bringing it from nonfunctional on Chrome to
functional but inconsistent with the operating system style, and from
functional but inconsistent on Firefox to fully functional).

The reason that Chrome does not respect the system highlight style
appears to be either a bug or an intentional choice - the rule is
getting correctly applied, but Chrome has the incorrect definition for
the "highlight" color.
  • Loading branch information
WesleyAC committed Jul 16, 2020
1 parent e225f3a commit 76ead4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions latex.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
margin-right: -0.15rem;
text-shadow: none; }

.latex::selection, .latex span:not(.latex-sup)::selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
background: #b4d5fe; }

.latex::-moz-selection, .latex span:not(.latex-sup)::-moz-selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
background: #b4d5fe; }
.latex::selection, .latex span:not(.latex-sup)::selection { text-shadow: 0.03em 0 highlight, -0.03em 0 highlight, 0 0.03em highlight, 0 -0.03em highlight, 0.06em 0 highlight, -0.06em 0 highlight, 0.09em 0 highlight, -0.09em 0 highlight, 0.12em 0 highlight, -0.12em 0 highlight, 0.15em 0 highlight, -0.15em 0 highlight;
background: highlight;
color: highlighttext; }
7 changes: 4 additions & 3 deletions tufte.css
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,10 @@ a:link, .tufte-underline, .hover-tufte-underline:hover {
}

a:link::selection,
a:link::-moz-selection {
text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
background: #b4d5fe;
a:link ::selection {
text-shadow: 0.03em 0 highlight, -0.03em 0 highlight, 0 0.03em highlight, 0 -0.03em highlight, 0.06em 0 highlight, -0.06em 0 highlight, 0.09em 0 highlight, -0.09em 0 highlight, 0.12em 0 highlight, -0.12em 0 highlight, 0.15em 0 highlight, -0.15em 0 highlight;
background-color: highlight;
color: highlighttext;
}

/* Sidenotes, margin notes, figures, captions */
Expand Down

0 comments on commit 76ead4d

Please sign in to comment.