-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodelab-css.html
More file actions
601 lines (536 loc) · 22.7 KB
/
codelab-css.html
File metadata and controls
601 lines (536 loc) · 22.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ai CodeLab - Core Documentation</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Modern Styles -->
<link rel="stylesheet" href="styles.css">
<style>
.study-grid {
display: grid;
grid-template-columns: 3fr 1fr;
gap: 3rem;
max-width: 1400px;
margin: 0 auto;
}
.study-content {
background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
border: 1px solid var(--glass-border);
border-radius: 20px;
padding: 3rem;
backdrop-filter: blur(20px);
color: var(--text-pure);
}
.study-content h1, .study-content h2, .study-content h3 {
color: var(--secondary);
margin-top: 2.5rem;
margin-bottom: 1rem;
border-bottom: 1px solid var(--glass-border);
padding-bottom: 0.5rem;
}
.study-content h1 {
color: var(--primary);
font-size: 3rem;
}
.study-content p, .study-content li {
margin-bottom: 1.2rem;
color: var(--text-muted);
line-height: 1.8;
font-size: 1.05rem;
}
.study-content ul, .study-content ol {
margin-left: 2rem;
margin-bottom: 2rem;
}
.study-content pre {
background: rgba(0,0,0,0.6);
border: 1px solid var(--glass-border);
padding: 1.5rem;
border-radius: 10px;
overflow-x: auto;
margin-bottom: 2rem;
color: var(--accent);
font-family: monospace;
box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
.study-sidebar {
background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
border: 1px solid var(--glass-border);
border-radius: 20px;
padding: 2rem;
backdrop-filter: blur(20px);
position: sticky;
top: 100px;
height: fit-content;
}
.study-sidebar h2 {
color: var(--primary);
margin-bottom: 1.5rem;
border-bottom: 1px solid var(--glass-border);
padding-bottom: 0.5rem;
font-size: 1.2rem;
}
.study-sidebar a {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.5rem 0;
color: var(--text-muted);
transition: all 0.3s;
}
.study-sidebar a:hover {
color: var(--secondary);
transform: translateX(5px);
}
@media (max-width: 900px) {
.study-grid { grid-template-columns: 1fr; }
.study-sidebar { position: relative; top: 0; }
}
</style>
</head>
<body>
<!-- Custom Cursor -->
<div id="custom-cursor"></div>
<!-- Animated Mesh Gradient Background -->
<div class="mesh-bg">
<div class="blob blob-1"></div>
<div class="blob blob-2"></div>
<div class="blob blob-3"></div>
</div>
<!-- Modern Extreme Navbar -->
<nav>
<div class="logo-container">
<i class="fas fa-robot"></i>
<span>CodeLab<span style="color:var(--primary)">.ai</span></span>
</div>
<div class="nav-links">
<a href="index.html">Platform</a>
<a href="courses.html">Syllabus</a>
<a href="study.html" class="active">Resources</a>
<a href="join.html">Community</a>
</div>
<div style="display:flex;gap:10px;">
<a href="login.html" class="magnetic-btn" style="padding: 0.5rem 1.5rem; font-size: 0.9rem;"><span>Login</span></a>
</div>
</nav>
<!-- Page Title Header -->
<header style="margin-top: 120px; text-align: center; padding: 2rem;">
<h1 class="hover-target" style="font-size: clamp(2.5rem, 5vw, 4rem);"><span class="gradient-text">Protocol</span> Documentation</h1>
</header>
<main style="padding: 2rem;">
<div class="study-grid">
<div class="study-content reveal hover-target" data-tilt>
<div class="content">
<h1>CSS Basics for Beginners</h1>
<p>Welcome to AICode Lab's CSS tutorial for beginners! Cascading Style Sheets (CSS) is what makes the web beautiful. While HTML provides the structure of a webpage, CSS is responsible for how it looks.</p>
<p>In this guide, we'll cover the fundamentals of CSS with simple examples that you can experiment with right away.</p>
<h2 id="what-is-css">What is CSS?</h2>
<p>CSS stands for Cascading Style Sheets. It's a language used to describe the presentation of HTML documents. With CSS, you can control the layout, colors, fonts, and much more.</p>
<h2 id="how-to-add-css">How to Add CSS to HTML</h2>
<p>There are three ways to add CSS to an HTML document:</p>
<h3>1. Inline CSS</h3>
<p>Using the <code>style</code> attribute directly in HTML elements:</p>
<div class="example-box">
<div class="example-code">
<pre><p style="color: blue; font-size: 18px;">This is a blue paragraph with 18px font size.</p></pre>
</div>
<div class="example-result">
<p style="color: blue; font-size: 18px;">This is a blue paragraph with 18px font size.</p>
</div>
</div>
<h3>2. Internal CSS</h3>
<p>Using the <code><style></code> element in the <code><head></code> section of an HTML page:</p>
<div class="example-box">
<div class="example-code">
<pre><head>
<style>
p {
color: green;
font-size: 16px;
}
</style>
</head>
<body>
<p>This paragraph would be green with 16px font size.</p>
</body></pre>
</div>
</div>
<h3>3. External CSS</h3>
<p>Creating a separate .css file and linking it using the <code><link></code> element:</p>
<div class="example-box">
<div class="example-code">
<pre><head>
<link rel="stylesheet" href="styles.css">
</head></pre>
</div>
</div>
<p>This is the most recommended method for larger websites as it separates your HTML content from the CSS styling.</p>
<h2 id="css-syntax">CSS Syntax</h2>
<p>CSS syntax consists of a selector and a declaration block:</p>
<div class="example-box">
<div class="example-code">
<pre>selector {
property: value;
another-property: another-value;
}</pre>
</div>
</div>
<ul>
<li><strong>Selector:</strong> Points to the HTML element you want to style</li>
<li><strong>Declaration Block:</strong> Contains one or more declarations separated by semicolons</li>
<li><strong>Property:</strong> The style attribute you want to change</li>
<li><strong>Value:</strong> The value for the property</li>
</ul>
<h2 id="css-selectors">CSS Selectors</h2>
<p>Selectors are patterns used to select and style HTML elements. Here are the most common ones:</p>
<h3>Element Selector</h3>
<p>Selects all elements with the specified tag name:</p>
<div class="example-box">
<div class="example-code">
<pre>p {
color: red;
}</pre>
</div>
<div class="example-result">
<p class="text-red">This paragraph would be red.</p>
</div>
</div>
<h3>Class Selector</h3>
<p>Selects all elements with the specified class attribute:</p>
<div class="example-box">
<div class="example-code">
<pre>.highlight {
background-color: yellow;
font-weight: bold;
}</pre>
</div>
<div class="example-result">
<p class="bg-yellow" style="font-weight: bold;">This paragraph has the highlight class.</p>
</div>
</div>
<h3>ID Selector</h3>
<p>Selects the element with the specified id attribute:</p>
<div class="example-box">
<div class="example-code">
<pre>#header {
background-color: black;
color: white;
}</pre>
</div>
</div>
<h2 id="colors">CSS Colors</h2>
<p>CSS offers several ways to specify colors:</p>
<h3>Color Names</h3>
<div class="example-box">
<div class="example-code">
<pre>p {
color: red;
}</pre>
</div>
<div class="example-result">
<p class="text-red">This text is red.</p>
</div>
</div>
<h3>RGB Values</h3>
<div class="example-box">
<div class="example-code">
<pre>p {
color: rgb(0, 0, 255);
}</pre>
</div>
<div class="example-result">
<p class="text-blue">This text is blue using RGB.</p>
</div>
</div>
<h3>HEX Values</h3>
<div class="example-box">
<div class="example-code">
<pre>p {
color: #00FF00;
}</pre>
</div>
<div class="example-result">
<p class="text-green">This text is green using HEX.</p>
</div>
</div>
<h2 id="text-styling">Text Styling</h2>
<p>CSS provides properties to style text:</p>
<div class="example-box">
<div class="example-code">
<pre>p {
font-family: Arial, sans-serif;
font-size: 16px;
font-weight: bold;
text-align: center;
text-decoration: underline;
line-height: 1.5;
}</pre>
</div>
<div class="example-result">
<p style="font-family: Arial, sans-serif; font-size: 16px; font-weight: bold; text-align: center; text-decoration: underline; line-height: 1.5;">This text has various styling properties applied.</p>
</div>
</div>
<h2 id="box-model">CSS Box Model</h2>
<p>The CSS box model is a fundamental concept that describes how elements are sized, spaced, and positioned. It consists of:</p>
<ul>
<li><strong>Content:</strong> The actual content of the element</li>
<li><strong>Padding:</strong> Space between the content and the border</li>
<li><strong>Border:</strong> A border around the padding</li>
<li><strong>Margin:</strong> Space outside the border</li>
</ul>
<h3>Border Example</h3>
<div class="example-box">
<div class="example-code">
<pre>div {
border: 2px solid black;
padding: 10px;
margin: 10px 0;
}</pre>
</div>
<div class="example-result">
<div class="border-demo">This div has a border, padding, and margin.</div>
</div>
</div>
<h3>Margin Example</h3>
<div class="example-box">
<div class="example-code">
<pre>div {
margin: 20px;
border: 1px solid blue;
background-color: #e6f2ff;
}</pre>
</div>
<div class="example-result">
<div class="margin-demo">This div has a margin of 20px.</div>
</div>
</div>
<h3>Padding Example</h3>
<div class="example-box">
<div class="example-code">
<pre>div {
padding: 20px;
border: 1px solid green;
background-color: #e6ffe6;
}</pre>
</div>
<div class="example-result">
<div class="padding-demo">This div has padding of 20px.</div>
</div>
</div>
<h2 id="layout">CSS Layout</h2>
<p>CSS offers several techniques for controlling the layout of webpages:</p>
<h3>Float</h3>
<div class="example-box">
<div class="example-code">
<pre>.float-left {
float: left;
margin-right: 15px;
width: 100px;
height: 100px;
background-color: #ffcccc;
}</pre>
</div>
<div class="example-result">
<div class="float-left">Float</div>
<p>This text will wrap around the floated element. This demonstrates how float works to position elements and how text flows around them.</p>
<div class="clear-both"></div>
</div>
</div>
<h3>Flexbox</h3>
<div class="example-box">
<div class="example-code">
<pre>.flex-container {
display: flex;
}
.flex-item {
flex: 1;
}</pre>
</div>
<div class="example-result">
<div class="flex-container">
<div class="flex-item">Flex Item 1</div>
<div class="flex-item">Flex Item 2</div>
<div class="flex-item">Flex Item 3</div>
</div>
</div>
</div>
<h3>CSS Grid</h3>
<div class="example-box">
<div class="example-code">
<pre>.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 10px;
}</pre>
</div>
<div class="example-result">
<div class="grid-container">
<div class="grid-item">Grid Item 1</div>
<div class="grid-item">Grid Item 2</div>
<div class="grid-item">Grid Item 3</div>
<div class="grid-item">Grid Item 4</div>
<div class="grid-item">Grid Item 5</div>
<div class="grid-item">Grid Item 6</div>
</div>
</div>
</div>
<h2 id="responsive">Responsive Design</h2>
<p>Responsive design ensures that your website looks good on all devices. Media queries are the foundation of responsive design:</p>
<div class="example-box">
<div class="example-code">
<pre>/* For mobile phones */
@media screen and (max-width: 768px) {
body {
font-size: 14px;
}
.container {
width: 100%;
}
}</pre>
</div>
</div>
<h2 id="transitions">CSS Transitions</h2>
<p>Transitions allow elements to change values smoothly:</p>
<div class="example-box">
<div class="example-code">
<pre>button {
background-color: blue;
color: white;
transition: background-color 0.3s ease;
}
button:hover {
background-color: darkblue;
}</pre>
</div>
<div class="example-result">
<button style="background-color: blue; color: white; transition: background-color 0.3s ease; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer;">Hover over me</button>
</div>
</div>
<h2 id="common-properties">Common CSS Properties</h2>
<p>Here's a table of commonly used CSS properties:</p>
<table class="property-table">
<thead>
<tr>
<th>Property</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>color</td>
<td>Sets text color</td>
<td><code>color: blue;</code></td>
</tr>
<tr>
<td>background-color</td>
<td>Sets background color</td>
<td><code>background-color: #f0f0f0;</code></td>
</tr>
<tr>
<td>font-family</td>
<td>Sets font type</td>
<td><code>font-family: Arial, sans-serif;</code></td>
</tr>
<tr>
<td>font-size</td>
<td>Sets font size</td>
<td><code>font-size: 16px;</code></td>
</tr>
<tr>
<td>margin</td>
<td>Sets margin area</td>
<td><code>margin: 10px 5px;</code></td>
</tr>
<tr>
<td>padding</td>
<td>Sets padding area</td>
<td><code>padding: 10px;</code></td>
</tr>
<tr>
<td>border</td>
<td>Sets border</td>
<td><code>border: 1px solid black;</code></td>
</tr>
<tr>
<td>width</td>
<td>Sets width</td>
<td><code>width: 100px;</code></td>
</tr>
<tr>
<td>height</td>
<td>Sets height</td>
<td><code>height: 200px;</code></td>
</tr>
<tr>
<td>display</td>
<td>Sets display type</td>
<td><code>display: flex;</code></td>
</tr>
</tbody>
</table>
</div>
<aside class="sidebar">
<h2>Artical Topics</h2>
<ul class="topics-list">
<li><a href="#what-is-css">What is CSS?</a></li>
<li><a href="#how-to-add-css">How to Add CSS</a></li>
<li><a href="#css-syntax">CSS Syntax</a></li>
<li><a href="#css-selectors">CSS Selectors</a></li>
<li><a href="#colors">CSS Colors</a></li>
<li><a href="#text-styling">Text Styling</a></li>
<li><a href="#box-model">CSS Box Model</a></li>
<li><a href="#layout">CSS Layout</a></li>
<li><a href="#responsive">Responsive Design</a></li>
<li><a href="#transitions">CSS Transitions</a></li>
<li><a href="#common-properties">Common Properties</a></li>
</ul>
<h3 style="margin-top: 2rem;">Resources</h3>
<ul class="topics-list">
<li><a href="#">CSS Cheat Sheet</a></li>
<li><a href="#">Advanced CSS Tutorial</a></li>
<li><a href="#">CSS Frameworks</a></li>
<li><a href="#">Practice Exercises</a></li>
</ul>
</aside>\n </div>\n <aside class="study-sidebar reveal">\n<h2>Artical Topics</h2>
<ul class="topics-list">
<li><a href="#what-is-css">What is CSS?</a></li>
<li><a href="#how-to-add-css">How to Add CSS</a></li>
<li><a href="#css-syntax">CSS Syntax</a></li>
<li><a href="#css-selectors">CSS Selectors</a></li>
<li><a href="#colors">CSS Colors</a></li>
<li><a href="#text-styling">Text Styling</a></li>
<li><a href="#box-model">CSS Box Model</a></li>
<li><a href="#layout">CSS Layout</a></li>
<li><a href="#responsive">Responsive Design</a></li>
<li><a href="#transitions">CSS Transitions</a></li>
<li><a href="#common-properties">Common Properties</a></li>
</ul>
<h3 style="margin-top: 2rem;">Resources</h3>
<ul class="topics-list">
<li><a href="#">CSS Cheat Sheet</a></li>
<li><a href="#">Advanced CSS Tutorial</a></li>
<li><a href="#">CSS Frameworks</a></li>
<li><a href="#">Practice Exercises</a></li>
</ul>\n </aside>
</div>
</div>
</main>
<!-- Footer -->
<footer>
<div class="footer-grid reveal">
<div>
<h2 class="footer-logo">CodeLab<span style="color:var(--primary)">.ai</span></h2>
<p class="footer-p">The frontier of learning.</p>
</div>
</div>
<div style="text-align: center; border-top: 1px solid var(--glass-border); padding-top: 2rem; margin-top:2rem; color:var(--text-muted); font-size: 0.9rem;">
© 2026 CodeLab.ai Operations. All Rights Reserved.
</div>
</footer>
<script src="script.js"></script>
</body>
</html>