Skip to content

Commit 0958295

Browse files
committed
refactor: refine critical CSS for improved layout stability and element constraints in index.html
- Updated critical CSS to better constrain elements before Tailwind CSS loads, preventing layout shifts. - Enhanced comments for clarity on the purpose of CSS rules. - Adjusted SVG and form element styles for consistent sizing and to prevent expansion during loading.
1 parent 652cf2a commit 0958295

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

index.html

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -89,53 +89,51 @@
8989
#root { min-height: 100vh; }
9090
body { margin: 0; background-color: #f9fafb; }
9191

92-
/* CRITICAL CSS: Hide unstyled content until CSS loads */
93-
/* This prevents all unstyled elements from expanding */
92+
/* CRITICAL CSS: Constrain elements before Tailwind CSS loads */
93+
/* This prevents unstyled elements from expanding */
9494

95-
/* Hide all elements that depend on Tailwind classes */
96-
/* They'll become visible once external CSS loads */
97-
[class*="bg-"],
98-
[class*="text-"],
99-
[class*="w-"],
100-
[class*="h-"],
101-
[class*="p-"],
102-
[class*="m-"],
103-
[class*="flex"],
104-
[class*="grid"],
105-
[class*="border"],
106-
[class*="rounded"],
107-
[class*="shadow"],
108-
[class*="hover:"],
109-
[class*="dark:"],
110-
[class*="gap-"],
111-
[class*="space-"],
112-
[class*="divide-"] {
113-
opacity: 0;
114-
transition: opacity 0.3s ease-in;
115-
}
116-
117-
/* Fallback: Constrain all SVGs to prevent expansion */
95+
/* Constrain all SVGs to prevent huge expansion */
11896
svg {
119-
width: 2rem;
120-
height: 2rem;
97+
width: auto;
98+
height: auto;
99+
max-width: 2rem;
100+
max-height: 2rem;
121101
display: inline-block;
122102
flex-shrink: 0;
103+
overflow: hidden;
123104
}
124105

125-
/* Constrain inputs and buttons */
106+
/* Constrain inputs, buttons, and form elements */
126107
input,
127108
button,
128109
select,
129110
textarea {
130111
font-size: 16px;
131112
padding: 8px;
132-
height: auto;
133113
min-height: 40px;
134114
}
135115

136-
/* Prevent any element from expanding */
116+
/* Prevent flex containers from expanding */
117+
[class*="flex"] {
118+
display: flex;
119+
flex-wrap: wrap;
120+
gap: 8px;
121+
}
122+
123+
/* Prevent grid containers from expanding */
124+
[class*="grid"] {
125+
display: grid;
126+
gap: 8px;
127+
}
128+
129+
/* Constrain all elements */
137130
* {
138131
box-sizing: border-box;
132+
}
133+
134+
/* Header baseline styling */
135+
header {
136+
display: block;
139137
max-width: 100%;
140138
}
141139
</style>

0 commit comments

Comments
 (0)