Skip to content

Instantly share code, notes, and snippets.

@houshuang
Created February 20, 2025 07:08
Show Gist options
  • Save houshuang/c84beac96a0a16803fff698cb0de93ac to your computer and use it in GitHub Desktop.
Save houshuang/c84beac96a0a16803fff698cb0de93ac to your computer and use it in GitHub Desktop.
FRONT CARD
<br><br>
<div class="container">
<div class="sentence">
{{Front}}
</div>
</div>
</div>
<script>
function show(wordId) {
// Hide default text
document.querySelector('.default-text').style.display = 'none';
// Hide all definitions
document.querySelectorAll('.def').forEach(def => {
def.classList.remove('active');
});
// Show selected definition
document.getElementById(wordId).classList.add('active');
}
</script>
<div class="definition-box">
<div class="default-text"></div>
{{Glosses}}
</div>
</div>
----
STYLING
.card {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
font-size: 21px;
text-align: center;
color: #0a4d90;
}
p { font-size: 90%; }
a { color: inherit; text-decoration: none; }
i { font-size: 100%; font-weight: bold; }
hr {
margin-left: 20%;
margin-right: 20%;
margin-top: 20px;
margin-bottom: 15px;
}
.separator {
display: flex;
align-items: center;
text-align: center;
font-size: 70%;
margin-top: 10px;
margin-bottom: 10px;
}
.separator::before,
.separator::after {
content: '';
flex: 1;
margin: 0% 20% 0 20%;
border-bottom: 1px solid;
}
.separator:not(:empty)::before {
margin-right: .25em;
}
.separator:not(:empty)::after {
margin-left: .25em;
}
#English {
margin-bottom: 30px;
}
.word {
position: relative;
display: inline-block;
margin-right: 4px;
cursor: pointer;
}
.word:hover {
color: #2563eb;
}
.definition-box {
font-size: 70%;
text-align: left;
line-height: 130%;
min-height: 80px;
max-width: 500px;
border-radius: 8px;
margin: 10px auto 0 auto;
}
.def {
display: none;
opacity: 0;
}
.def.active {
display: block;
opacity: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment