For docs-vanilla-theme I've been updating the links to the new style. I copied what @anthonydillon had done for cloud-vanilla-theme, as I believe this reflects the latest thinking for links.
ul,
... {
a,
... {
color: $cool-grey;
font-weight: normal;
...
}
}
a,
p a,
... {
color: $link-color;
font-weight: 300;
...
}
This intended to achieve the following:
- Normal links (inside text blocks) are blue and 300 weight
- Links directly inside list items are black and 400 weight
- Links inside list items inside paragraph items (
<li><p><a>
) are blue and 300 weight again
Clearly the idea is that if you're placing links directly inside list items, you want them to stand out:
<ul>
<li><a>Standout link</a></li>
</ul>
If you want to place plain text in your lists, you have to add a wrapping paragraph element:
<ul>
<li><p>Some text with <a>a link</a></p></li>
</ul>
However, this doesn't work with the latest version of vanilla because the latter format adds significant unintended spacing:
![with vanilla 1.0.1](https://camo.githubusercontent.com/c033d47beca9d37b89995ea27d53f274ecf66a85fabad8636a348456cfc6c472/68747470733a2f2f6173736574732e7562756e74752e636f6d2f76312f35396561383538642d76616e696c6c612d702e706e67)
My suggestion
I would like to suggest we can avoid this sort of issue by keeping our base styles as simple as possible.
For me that would mean that the default link would simply inherit the font-weight of the context, and we should override it as rarely as possible:
a {
color: $link-color;
font-weight: inherit;
&:hover {
text-decoration: underline;
}
}
I would say this should even extend to navigation, in that rather than setting a separate style for nav a
, we should set specific styles for each type of navigation, e.g. for p-navigation__link
etc. As I don't think we can effectively predict all the places in which people might want to use a nav
and what they might want the styling to look like.
Then if we want to be able to create a list of links that stand out more, that should be an extra pattern, e.g. .p-standout-list
or something:
.p-standout-list__link {
color: $color-dark;
font-weight: 400;
}