mirror of
https://codeberg.org/vlw/victorwesterlund.com.git
synced 2025-09-14 11:33:41 +02:00
Fixed content offset
- Added offset calculator - Added some media queries
This commit is contained in:
parent
d6e4b71f28
commit
aa3189be89
2 changed files with 41 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Victor Westerlund */
|
||||
/* Victor Westerlund - www.victorwesterlund.com */
|
||||
:root {
|
||||
--palette-background: 255,255,255;
|
||||
--palette-contrast: 33,33,33;
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
*::selection {
|
||||
background-color: var(--swatch-contrast);
|
||||
color: var(--swatch-accent);
|
||||
color: var(--swatch-background);
|
||||
}
|
||||
|
||||
html,
|
||||
|
@ -55,17 +55,39 @@ a {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
a::after {
|
||||
content: " →";
|
||||
}
|
||||
|
||||
main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 30px;
|
||||
font-size: clamp(18px,5vw,3vh);
|
||||
font-size: 20px;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* -- Content -- */
|
||||
|
||||
/* -- Media Queries -- */
|
||||
|
||||
@media (max-width: 300px) {
|
||||
main {
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
a::after {
|
||||
content: ": " attr(href);
|
||||
}
|
||||
}
|
||||
|
||||
@media (pointer: fine) {
|
||||
a:hover {
|
||||
background: rgba(var(--palette-contrast),.1);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--palette-background: 0,0,0;
|
||||
|
|
|
@ -10,9 +10,21 @@
|
|||
<link rel="stylesheet" href="assets/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<main class="hidden">
|
||||
<p>victor westerlund</p>
|
||||
<a href="https://github.com/VictorWesterlund"><p>github →</p></a>
|
||||
<p><a href="https://github.com/VictorWesterlund">github</a></p>
|
||||
</main>
|
||||
<script>
|
||||
// Compensate for native elements (like the brower navbar)
|
||||
function updateOffset() {
|
||||
const offset = (window.outerHeight - window.innerHeight) / 2;
|
||||
if(offset > -1) {
|
||||
const main = document.getElementsByTagName("main")[0];
|
||||
main.style.setProperty("transform",`translateY(-${offset}px)`);
|
||||
}
|
||||
}
|
||||
window.addEventListener("resize",() => updateOffset());
|
||||
updateOffset();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Reference in a new issue