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.

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 12, 2020
1 parent e225f3a commit f321207
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 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; }
8 changes: 4 additions & 4 deletions tufte.css
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,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 f321207

Please sign in to comment.