Customise CSS :focus selector

This commit is contained in:
Helen Chong 2023-08-29 16:30:47 +08:00
parent d6b90271b8
commit e1ce4f2a5b
6 changed files with 86 additions and 28 deletions

View File

@ -40,11 +40,11 @@
<h1>Website Changelog Archive: 2022</h1> <h1>Website Changelog Archive: 2022</h1>
<p>You can subscribe to the <a href="/feed.xml" target="blank">Leilukin's Hub RSS feed</a> or follow <a href="https://neocities.org/site/leilukin" target="_blank">my Neocities profile</a> to get notified of the updates on this website.</p> <p>You can subscribe to the <a href="/feed.xml" target="blank">Leilukin's Hub RSS feed</a> or follow <a href="https://neocities.org/site/leilukin" target="_blank">my Neocities profile</a> to get notified of the updates on this website.</p>
<p> <div class="web-btn-wrapper">
<a href="/feed.xml" target="blank" title="Leilukin's Hub RSS Feed"> <a href="/feed.xml" target="blank" title="Leilukin's Hub RSS Feed" class="center-el">
<img src="/assets/rss-button.gif" alt="RSS feed button" class="center-el"> <img src="/assets/rss-button.gif" alt="RSS feed button">
</a> </a>
</p> </div>
<p class="center-text"> <p class="center-text">
Archive: <a href="../changelog/">Latest</a> | <span class="bold-text">2022</span> | <a href="./layouts.html">Website Layouts</a> Archive: <a href="../changelog/">Latest</a> | <span class="bold-text">2022</span> | <a href="./layouts.html">Website Layouts</a>

View File

@ -40,11 +40,11 @@
<h1>Website Changelog</h1> <h1>Website Changelog</h1>
<p>You can subscribe to the <a href="/feed.xml" target="blank">Leilukin's Hub RSS feed</a> or follow <a href="https://neocities.org/site/leilukin" target="_blank">my Neocities profile</a> to get notified of the updates on this website.</p> <p>You can subscribe to the <a href="/feed.xml" target="blank">Leilukin's Hub RSS feed</a> or follow <a href="https://neocities.org/site/leilukin" target="_blank">my Neocities profile</a> to get notified of the updates on this website.</p>
<p> <div class="web-btn-wrapper">
<a href="/feed.xml" target="blank" title="Leilukin's Hub RSS Feed"> <a href="/feed.xml" target="blank" title="Leilukin's Hub RSS Feed" class="center-el">
<img src="/assets/rss-button.gif" alt="RSS feed button" class="center-el"> <img src="/assets/rss-button.gif" alt="RSS feed button">
</a> </a>
</p> </div>
<p class="center-text"> <p class="center-text">
Archive: <span class="bold-text">Latest</span> | <a href="./2022.html">2022</a> | <a href="./layouts.html">Website Layouts</a> Archive: <span class="bold-text">Latest</span> | <a href="./2022.html">2022</a> | <a href="./layouts.html">Website Layouts</a>
@ -62,6 +62,7 @@
<li><a href="/shrines/asummersend/"><cite>A Summers End — Hong Kong 1986</cite> shrine</a>: Updated the main page with information about the spiritual sequel <cite>In the Ocean I Learned to Float</cite>.</li> <li><a href="/shrines/asummersend/"><cite>A Summers End — Hong Kong 1986</cite> shrine</a>: Updated the main page with information about the spiritual sequel <cite>In the Ocean I Learned to Float</cite>.</li>
<li><a href="/shrines/cassettebeasts/"><cite>Cassette Beasts</cite> shrine</a>: Adjusted header image and added more images to the home page.</li> <li><a href="/shrines/cassettebeasts/"><cite>Cassette Beasts</cite> shrine</a>: Adjusted header image and added more images to the home page.</li>
<li>Leilukin Hub now has an <a href="/feed.xml" target="blank">RSS feed</a>.</li> <li>Leilukin Hub now has an <a href="/feed.xml" target="blank">RSS feed</a>.</li>
<li>Improved accessibility of the site's design by customising the CSS <code class="inline-code">:focus</code> selector.</li>
</ul> </ul>
<p class="date-style">August 26, 2023:</p> <p class="date-style">August 26, 2023:</p>

View File

@ -1,3 +1,18 @@
:root {
--clr-body-bg: #000000;
--clr-body-txt: #ffffff;
--clr-h1: #BA6FE8;
--clr-link-btn-bg: #7A37A3;
--clr-link-btn-hover: #BA6FE8;
--fs-h1: 4rem;
--fs-body: 1rem;
--fs-link-btn: 2rem;
--fw-reg: 400;
--fw-link-btn: 600;
}
/* CSS RESET */ /* CSS RESET */
/* Box sizing rules */ /* Box sizing rules */
*, *,
@ -76,7 +91,7 @@ select {
/* STYLING BEGINS */ /* STYLING BEGINS */
body { body {
font-size: 1rem; /* 16px */ font-size: var(--clr-body-bg);
font-family: 'Source Sans Pro', Arial, Helvetica, sans-serif; font-family: 'Source Sans Pro', Arial, Helvetica, sans-serif;
color: #FFFFFF; color: #FFFFFF;
background: #000000; background: #000000;
@ -96,9 +111,9 @@ main {
} }
h1 { h1 {
font-size: 4rem; font-size: var(--fs-h1);
color: #BA6FE8; color: var(--clr-h1);
font-weight: normal; font-weight: var(--fw-reg);
letter-spacing: 0.08em; letter-spacing: 0.08em;
margin: 2rem 0; margin: 2rem 0;
line-height: 1; line-height: 1;
@ -116,19 +131,28 @@ p {
.index__link { .index__link {
text-decoration: none; text-decoration: none;
font-size: 2rem; font-size: var(--fs-link-btn);
font-weight: 600; font-weight: var(--fw-link-btn);
border: none; border: none;
border-radius: 0.6rem; border-radius: 0.6rem;
padding: 1rem 1.25rem; padding: 1rem 1.25rem;
margin: 0.5rem; margin: 0.5rem;
background: #7A37A3; background: var(--clr-link-btn-bg);
color: white; color: var(--clr-body-txt);
text-transform: uppercase; text-transform: uppercase;
} }
.index__link:hover { .index__link:hover {
cursor: pointer; cursor: pointer;
background: #BA6FE8; background: var(--clr-link-btn-hover);
transition: 0.5s; transition: 0.5s;
} }
.index__link:focus {
outline-offset: 0.2rem;
outline: 0.2rem solid var(--clr-body-txt);
}
a:focus img {
outline: 0.2rem solid var(--clr-body-txt);
}

View File

@ -173,6 +173,10 @@ strong {
color: var(--clr-bold-txt); color: var(--clr-bold-txt);
} }
:focus {
outline: 0.15rem solid var(--clr-body-txt);
}
a { a {
font-weight: 700; font-weight: 700;
color: var(--clr-link); color: var(--clr-link);
@ -182,6 +186,14 @@ a:hover {
color: var(--clr-link-hover); color: var(--clr-link-hover);
} }
a:not([class]):focus {
outline: 0.15rem solid var(--clr-link);
}
a:focus img {
outline: 0.2rem solid var(--clr-body-txt);
}
blockquote { blockquote {
margin: 1.5rem 0; margin: 1.5rem 0;
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
@ -193,6 +205,11 @@ button:hover {
cursor: pointer; cursor: pointer;
} }
button:focus,
detail:focus {
outline-offset: 0.2rem;
}
pre { pre {
white-space: pre-wrap; white-space: pre-wrap;
overflow-x: auto; overflow-x: auto;
@ -258,6 +275,11 @@ summary {
color: var(--clr-link-hover); color: var(--clr-link-hover);
} }
.navbar a:focus {
outline-offset: 0.3rem;
outline: 0.15rem solid var(--clr-navbar-link);
}
.nav__menu { .nav__menu {
list-style: none; list-style: none;
padding: 0; padding: 0;
@ -376,15 +398,14 @@ article, .content-container {
/* CUSTOM CLASSES FOR SPECIAL ELEMENTS */ /* CUSTOM CLASSES FOR SPECIAL ELEMENTS */
.inline-code { .inline-code {
font-family: monospace; font-family: monospace;
border: 0.06rem solid var(--clr-code-border); border: 0.07rem solid var(--clr-code-border);
padding: 0.125rem 0.3rem; padding: 0.125rem 0.3rem;
margin-left: 0.125rem; margin: 0 0.125rem;
margin-right: 0.125rem; background: var(--clr-code-bg);
background-color: var(--clr-code-bg);
} }
.code-snippet { .code-snippet {
background-color: var(--clr-code-bg); background: var(--clr-code-bg);
border: 0.08rem solid var(--clr-code-border); border: 0.08rem solid var(--clr-code-border);
display: block; display: block;
padding: 0.5em 0.8rem; padding: 0.5em 0.8rem;
@ -393,7 +414,7 @@ article, .content-container {
} }
.text-box { .text-box {
background-color: var(--clr-quote-bg); background: var(--clr-quote-bg);
border: 0.06rem solid var(--clr-main-heading); border: 0.06rem solid var(--clr-main-heading);
padding: 0.625rem; padding: 0.625rem;
margin-bottom: 0.8rem; margin-bottom: 0.8rem;
@ -407,7 +428,7 @@ article, .content-container {
border-radius: 0.6rem; border-radius: 0.6rem;
padding: 0.75rem 1rem; padding: 0.75rem 1rem;
margin: 0.3rem; margin: 0.3rem;
background-color: var(--clr-link-btn-bg); background: var(--clr-link-btn-bg);
color: var(--clr-link-btn-txt); color: var(--clr-link-btn-txt);
cursor: pointer; cursor: pointer;
font-weight: 700; font-weight: 700;
@ -422,10 +443,15 @@ article, .content-container {
.link-btn:hover { .link-btn:hover {
cursor: pointer; cursor: pointer;
background-color: var(--clr-link-btn-hover); background: var(--clr-link-btn-hover);
transition: 0.5s; transition: 0.5s;
} }
.link-btn:focus {
outline-offset: 0.2rem;
outline: 0.15rem solid var(--clr-link);
}
/* Q&A accordion */ /* Q&A accordion */
.qna-accordion { .qna-accordion {
padding: 1rem 0; padding: 1rem 0;

View File

@ -9,6 +9,10 @@ main ul {
list-style: none; list-style: none;
} }
.link-list a:focus {
outline: 0.15rem solid var(--clr-link);
}
.link-list li { .link-list li {
padding-left: 0.5em; padding-left: 0.5em;
align-items: start; align-items: start;

View File

@ -73,13 +73,16 @@
<li>Added link button for the site's RSS feed.</li> <li>Added link button for the site's RSS feed.</li>
<li>Fixed the overflow issue of header images.</li> <li>Fixed the overflow issue of header images.</li>
<li>Added custom style for the <a href="/sitemap.html">Site Map</a> page.</li> <li>Added custom style for the <a href="/sitemap.html">Site Map</a> page.</li>
<li>Improved accessibility of the site's design by customising the CSS <code class="inline-code">:focus</code> selector.</li>
</ul> </ul>
<p><a href="/changelog">View all site changelog</a></p> <p><a href="/changelog">View all site changelog</a></p>
</div> </div>
<p>You can subscribe to the <a href="feed.xml" target="blank">Leilukin's Hub RSS feed</a> or follow <a href="https://neocities.org/site/leilukin" target="_blank">my Neocities profile</a> to get notified of the updates on this website.</p> <p>You can subscribe to the <a href="feed.xml" target="blank">Leilukin's Hub RSS feed</a> or follow <a href="https://neocities.org/site/leilukin" target="_blank">my Neocities profile</a> to get notified of the updates on this website.</p>
<div class="web-btn-wrapper">
<a href="/feed.xml" target="blank" title="Leilukin's Hub RSS Feed"> <a href="/feed.xml" target="blank" title="Leilukin's Hub RSS Feed">
<img src="/assets/rss-button.gif" alt="RSS feed button"> <img src="/assets/rss-button.gif" alt="RSS feed button">
</a> </a>
</div>
</section> </section>
<section class="content-section"> <section class="content-section">