Skip to content

Commit

Permalink
use 100dvh everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Feb 9, 2025
1 parent 149d41c commit 739eeba
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 24 deletions.
11 changes: 8 additions & 3 deletions src/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
--gold1: gold;
--red1: hsl(0, 70%, 45%);
--zebra: hsla(0, 0%, 50%, 0.05);
--100dvh: 100dvh;
@supports not (height: 1dvh) {
--100dvh: 100vh;
}
}
body {
font: normal 12px var(--family);
Expand All @@ -47,8 +51,7 @@ body {
margin: 0;
hyphens: auto;
.mobile > & {
height: 100vh; /* for old browsers */
height: 100dvh;
max-height: var(--100dvh);
}
&:lang(ja) {
font-family: Arial, 'Meiryo UI', 'MS Gothic', system-ui, sans-serif;
Expand All @@ -61,7 +64,9 @@ body {
font-family: Arial, 'Microsoft JhengHei UI', 'Microsoft JhengHei', system-ui, sans-serif;
}
}

.dvh100 {
height: var(--100dvh);
}
a {
color: var(--fg);
transition: color .1s;
Expand Down
4 changes: 2 additions & 2 deletions src/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</template>

<template data-id="body"> <!-- https://crbug.com/1288447 -->
<div id="header">
<div id="header" class="dvh100">
<h1 id="heading" i18n="data-edit:editStyleHeading, data-add:addStyleTitle">
<a class="usercss-only icon hide-if-sticky"
href="https://github.com/openstyles/stylus/wiki/Writing-UserCSS"
Expand Down Expand Up @@ -135,7 +135,7 @@ <h2><span i18n="linterIssues"></span><span id="issue-count"></span>
</template>
</head>

<body id="stylus-edit">
<body id="stylus-edit" class="dvh100">
<%= htmlWebpackPlugin.tags.bodyTags %>
</body>
</html>
7 changes: 1 addition & 6 deletions src/edit/edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ $plus-minus-pad: .5rem;
--target-gapY: 2px;
}

body {
height: 100vh;
}

#global-progress {
position: fixed;
height: 4px;
Expand Down Expand Up @@ -71,7 +67,6 @@ html:not(.is-new-style) #heading::before {
/************ header ************/
#header {
width: var(--header-width);
height: 100vh;
overflow: hidden;
position: fixed;
top: 0;
Expand Down Expand Up @@ -677,7 +672,7 @@ i,
padding: var(--pad-y2) var(--pad-x);
}
.contents {
max-height: calc(100vh - var(--top) - 4rem);
max-height: calc(var(--100dvh) - var(--top) - 4rem);
overflow-y: auto;
padding: var(--pad-y) var(--pad-x);
}
Expand Down
2 changes: 1 addition & 1 deletion src/install-usercss.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<span i18n="editGotoLine">: <input class="CodeMirror-jump-field" type="text"></span>
</template>
</head>
<body id="stylus-install-usercss">
<body id="stylus-install-usercss" class="dvh100">
<div id="header">
<div id="header-contents">
<h1 class="w100">
Expand Down
1 change: 0 additions & 1 deletion src/install-usercss/install-usercss.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
body {
overflow: hidden;
display: flex;
height: 100vh;
}

img.icon {
Expand Down
2 changes: 1 addition & 1 deletion src/js/dlg/message-box.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
min-width: 10rem;
max-width: 50vw;
min-height: 5rem;
max-height: 90dvh;
max-height: calc(var(--100dvh) - 2*var(--gap));
position: fixed;
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion src/manage.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h2 class="style-name">

<template data-id="body"> <!-- https://crbug.com/1288447 -->

<div id="header">
<div id="header" class="dvh100">
<h1 i18n="styleManager"></h1>

<label id="disableAll-label" i18n="data-on:disableAllStyles, data-off:disableAllStylesOff">
Expand Down
4 changes: 1 addition & 3 deletions src/manage/manage.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ $iconGapY: 4px;
body {
/* Fill the entire viewport to enable json import via drag'n'drop */
display: flex;
height: 100vh;
}

#header:lang(ja) h1 {
Expand Down Expand Up @@ -49,7 +48,6 @@ a, .disabled a:hover {
display: flex;
flex-flow: column;
width: var(--header-width);
height: 100vh;
position: fixed;
top: 0;
padding: $pad;
Expand Down Expand Up @@ -677,7 +675,7 @@ button i {
top: 0;
left: 0;
width: 100%;
height: 100vh;
height: var(--100dvh);
border: 0;
z-index: 2147483647;
background-color: hsla(0, 0%, 0%, .45);
Expand Down
2 changes: 1 addition & 1 deletion src/options.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html id="stylus">
<html id="stylus" class="dvh100">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand Down
8 changes: 3 additions & 5 deletions src/options/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background: none;
--pad: 1rem;
--pad05: calc(.5 * var(--pad));
Expand All @@ -13,10 +12,9 @@ body {
background: none;
display: flex;
flex-direction: column;
width: auto;
min-width: 400px; /* showing almost everything in one line in English and CJK */
max-width: 800px;
max-height: calc(100vh - 32px);
max-width: 850px;
max-height: var(--100dvh);
box-sizing: border-box;
border: 1px solid var(--c60);
box-shadow: 0px 5px 15px 3px hsla(0, 0%, 0%, .35);
}
Expand Down

0 comments on commit 739eeba

Please sign in to comment.