victor HF Staff commited on
Commit
cc97280
·
1 Parent(s): fd9cbc2

Use height: 100% instead of fixed min-height

Browse files

- Removed min-height: 500px, just use height: 100%
- Updated guide to clarify: never use vh units, always use %
- Simpler and more flexible approach

Files changed (2) hide show
  1. app.py +0 -1
  2. guide-gradio-with-html-and-js.md +4 -3
app.py CHANGED
@@ -63,7 +63,6 @@ html, body {
63
  align-items: center;
64
  justify-content: center;
65
  height: 100%;
66
- min-height: 500px;
67
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
68
  color: #fff;
69
  padding: 2rem;
 
63
  align-items: center;
64
  justify-content: center;
65
  height: 100%;
 
66
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
67
  color: #fff;
68
  padding: 2rem;
guide-gradio-with-html-and-js.md CHANGED
@@ -183,14 +183,14 @@ html, body {
183
 
184
  #app {
185
  height: 100%;
186
- min-height: 500px; /* Fixed minimum, not 100vh */
187
  }
188
 
189
  /* Prevent iframe resizer issues */
190
  html, body, #root, .gradio-container, .contain, gradio-app {
191
  height: 100% !important;
192
  overflow: hidden !important;
193
- min-height: 0 !important; /* Important! */
194
  }
195
 
196
  .contain, .main, gradio-app {
@@ -199,6 +199,8 @@ html, body, #root, .gradio-container, .contain, gradio-app {
199
  }
200
  ```
201
 
 
 
202
  ## Complete Example: Math Calculator
203
 
204
  ```python
@@ -232,7 +234,6 @@ html, body { height: 100%; overflow: hidden; }
232
  align-items: center;
233
  justify-content: center;
234
  height: 100%;
235
- min-height: 400px;
236
  background: #1a1a2e;
237
  color: white;
238
  gap: 1rem;
 
183
 
184
  #app {
185
  height: 100%;
186
+ /* Use 100% not 100vh - viewport units cause iframe resizer loops */
187
  }
188
 
189
  /* Prevent iframe resizer issues */
190
  html, body, #root, .gradio-container, .contain, gradio-app {
191
  height: 100% !important;
192
  overflow: hidden !important;
193
+ min-height: 0 !important; /* Important! Removes default min-height */
194
  }
195
 
196
  .contain, .main, gradio-app {
 
199
  }
200
  ```
201
 
202
+ **Key rule:** Never use `vh` units (`100vh`, `min-height: 100vh`). Always use `100%` which is relative to the parent, not the viewport.
203
+
204
  ## Complete Example: Math Calculator
205
 
206
  ```python
 
234
  align-items: center;
235
  justify-content: center;
236
  height: 100%;
 
237
  background: #1a1a2e;
238
  color: white;
239
  gap: 1rem;