Skip to content

Instantly share code, notes, and snippets.

@Olanetsoft
Created May 25, 2025 16:26
Show Gist options
  • Save Olanetsoft/358b924517b4780e93d30b608aefbc5c to your computer and use it in GitHub Desktop.
Save Olanetsoft/358b924517b4780e93d30b608aefbc5c to your computer and use it in GitHub Desktop.
Native Lazy Load - Styles.css
/* css/styles.css */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: system-ui, -apple-system, sans-serif;
line-height: 1.6;
color: #333;
}
header {
text-align: center;
padding: 2rem;
background: #f8f9fa;
}
header h1 {
color: #333;
margin-bottom: 0.5rem;
}
/* Hero section - loads immediately */
.hero {
height: 80vh;
position: relative;
overflow: hidden;
background: #000;
}
.hero-video {
width: 100%;
height: 100%;
object-fit: cover;
}
.hero-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}
.hero-content h2 {
font-size: 3rem;
margin-bottom: 1rem;
}
.hero-content p {
font-size: 1.5rem;
}
/* Spacer to demonstrate lazy loading */
.spacer {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
color: white;
text-align: center;
font-size: 1.5rem;
}
/* Demo section */
.demo-section {
padding: 4rem 2rem;
max-width: 800px;
margin: 0 auto;
}
.demo-section h2 {
margin-bottom: 2rem;
color: #333;
text-align: center;
}
/* Video container with aspect ratio */
.video-container {
position: relative;
width: 100%;
padding-bottom: 56.25%; /* 16:9 aspect ratio */
background-color: #000;
border-radius: 8px;
overflow: hidden;
margin-bottom: 2rem;
}
.lazy-video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
/* Code example */
.code-example {
background: #1e1e1e;
color: #f8f8f2;
padding: 1.5rem;
border-radius: 8px;
overflow-x: auto;
margin-bottom: 2rem;
}
.code-example pre {
margin: 0;
font-family: 'Courier New', monospace;
}
/* Method info box */
.method-info {
background: #f8f9fa;
padding: 2rem;
border-radius: 8px;
border-left: 4px solid #4361ee;
}
.method-info h3 {
margin-bottom: 1rem;
color: #333;
}
.method-info code {
background: #e9ecef;
padding: 0.2rem 0.4rem;
border-radius: 3px;
font-family: 'Courier New', monospace;
}
.pros-cons {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2rem;
margin-top: 1rem;
}
.pros h3 {
color: #10b981;
margin-bottom: 1rem;
}
.cons h3 {
color: #ef4444;
margin-bottom: 1rem;
}
.pros ul, .cons ul {
list-style: none;
padding-left: 0;
}
.pros li, .cons li {
margin-bottom: 0.5rem;
padding-left: 1.5rem;
position: relative;
}
.pros li:before {
content: '✅';
position: absolute;
left: 0;
}
.cons li:before {
content: '❌';
position: absolute;
left: 0;
}
/* Testing instructions */
.testing-box {
background: #e0f2fe;
border: 1px solid #0284c7;
border-radius: 8px;
padding: 1.5rem;
margin: 2rem 0;
}
.testing-box h3 {
color: #0369a1;
margin-bottom: 1rem;
}
.testing-box ol {
margin-left: 1.5rem;
}
.testing-box li {
margin-bottom: 0.5rem;
}
.testing-box p {
margin-top: 1rem;
font-weight: bold;
color: #0369a1;
}
/* Mobile responsive */
@media (max-width: 768px) {
.hero-content h2 {
font-size: 2rem;
}
.hero-content p {
font-size: 1.2rem;
}
.pros-cons {
grid-template-columns: 1fr;
gap: 1rem;
}
.demo-section {
padding: 2rem 1rem;
}
.spacer {
font-size: 1.2rem;
padding: 1rem;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment