-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #963 from alexwlchan/style-improvements
Assorted improvements and style fixes
- Loading branch information
Showing
11 changed files
with
107 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<ul class="plain_list article_cards article_cards--{{ include.articles.size }}"> | ||
{% for article in include.articles %} | ||
{% include article_card.html hide_date="true" %} | ||
{% include article_card.html %} | ||
{% endfor %} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
body { | ||
font: var(--font-size) var(--text-font-family); | ||
line-height: var(--line-height); | ||
color: var(--body-text); | ||
} | ||
|
||
h1, h2, h3 { | ||
color: var(--primary-color); | ||
font-weight: normal; | ||
} | ||
|
||
h1 { | ||
font-size: 2em; | ||
} | ||
|
||
h2 { | ||
margin-top: 2em; | ||
font-size: 1.5em; | ||
line-height: 1.5em; | ||
margin-bottom: 0; | ||
} | ||
|
||
a { | ||
text-underline-offset: 2px; | ||
color: var(--link-color); | ||
} | ||
|
||
a:visited { | ||
color: var(--body-text); | ||
} | ||
|
||
a:hover { | ||
color: var(--link-color); | ||
text-decoration: underline; | ||
text-decoration-thickness: 4px; | ||
text-decoration-skip-ink: none; | ||
} | ||
|
||
a.download { | ||
border-color: var(--link-color); | ||
|
||
/* We need to override the background styles */ | ||
color: var(--link-color) !important; | ||
background: rgba(white, 0.4) !important; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
layout: til | ||
title: There are limits on the styles you can apply with `:visited` | ||
date: 2024-12-25 20:04:39 +0000 | ||
tags: | ||
- css | ||
summary: | | ||
Because the `:visited` selector will tell you whether somebody has been to a URL, browsers limit what styles you can apply to such links -- to prevent somebody nefarious stealing your browsing history. | ||
--- | ||
I was tweaking the `a:visited` style on this site, and I was confused about why this wasn't working: | ||
|
||
``` | ||
a:visited { | ||
text-decoration-style: dashed; | ||
} | ||
``` | ||
|
||
I thought it might be a browser bug, or maybe some bad interaction between other `text-decoration` rules, but it turns out to be an intentional choice. | ||
|
||
A [Stack Overflow answer](https://stackoverflow.com/a/35037025/1558022) pointed to a page on MDN [Privacy and the :visited selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector#limits_to_visited_link_styles), which explains: | ||
|
||
> Before about 2010, the CSS :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited. […] To mitigate this problem, browsers have limited the amount of information that can be obtained from visited links. | ||
and there are only a few styles you can apply to `:visited` links: | ||
|
||
> You can style visited links, but there are limits to which styles you can use. Only the following styles can be applied to visited links: | ||
> | ||
> * `color` | ||
> * `background-color` | ||
> * `border-color` (and its sub-properties) | ||
> * `column-rule-color` | ||
> * `outline-color` | ||
> * `text-decoration-color` | ||
> * `text-emphasis-color` | ||
> * The color parts of the `fill` and `stroke` attributes | ||
This is annoying for my purposes, but it makes sense, and I'm glad to know it's not my own incompetence that was preventing this CSS from working! | ||
|
||
I briefly considered trying to find ways around this, like doing something with variables or trying to trick the browser somehow, but I decided against it. | ||
It'd be a fragile hack, and any loophole I found should be reported and fixed rather than used for my own enjoyment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters