-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path15css.html
More file actions
229 lines (203 loc) · 5.92 KB
/
15css.html
File metadata and controls
229 lines (203 loc) · 5.92 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
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-D0ENCWPZL9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-D0ENCWPZL9');
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>15. CSS Filters</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background: #1cc9be;
color: #222;
}
.section {
background: rgba(255, 255, 255, 0.3);
padding: 20px;
margin: 25px auto;
border-radius: 12px;
max-width: 1000px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
h2, h3 {
color: #333;
margin-bottom: 15px;
}
p {
font-size: 18px;
margin-bottom: 20px;
line-height: 1.7;
}
textarea {
width: 100%;
height: 170px;
font-family: 'Courier New', monospace;
font-size: 16px;
padding: 14px;
background-color: rgba(255, 255, 255, 0.95);
border: 2px solid #ccc;
border-radius: 10px;
margin: 12px 0;
color: #222;
transition: all 0.3s ease;
resize: vertical;
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
}
textarea:focus {
outline: none;
border-color: #00c6ff;
box-shadow: 0 0 8px rgba(0, 198, 255, 0.5);
}
button {
background: linear-gradient(135deg, #00c6ff, #0072ff);
color: white;
padding: 8px 18px;
font-size: 15px;
border: none;
border-radius: 30px;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
button:hover {
transform: scale(1.05);
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}
iframe {
width: 100%;
height: 160px;
border: 2px solid white;
background: rgba(255, 255, 255, 0.9);
border-radius: 10px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="section">
<h2>15. CSS Filters</h2>
<h3>I. Blur</h3>
<p><strong>Explanation:</strong> <code>blur()</code> filter image ya element ko dhundla banane ke liye use hota hai.
<br>
<br>
Note: use image link to see exact effect
</p>
<textarea id="code1">
<style>
.blur {
filter: blur(5px);
}
</style>
<img class="blur" src="image.jpg" alt="Blurred Image">
</textarea>
<button onclick="runCode('code1', 'output1')">Run Code</button>
<iframe id="output1"></iframe>
<h3>II. Brightness</h3>
<p><strong>Explanation:</strong> <code>brightness()</code> filter element ki brightness ko adjust karta hai. Value 0 se 1.5 tak hoti hai.</p>
<textarea id="code2">
<style>
.brightness {
filter: brightness(1.5);
}
</style>
<img class="brightness" src="image.jpg" alt="Bright Image">
</textarea>
<button onclick="runCode('code2', 'output2')">Run Code</button>
<iframe id="output2"></iframe>
<h3>III. Contrast</h3>
<p><strong>Explanation:</strong> <code>contrast()</code> filter element ki contrast ko badhane ya kam karne ke liye use hota hai.</p>
<textarea id="code3">
<style>
.contrast {
filter: contrast(2);
}
</style>
<img class="contrast" src="image.jpg" alt="High Contrast Image">
</textarea>
<button onclick="runCode('code3', 'output3')">Run Code</button>
<iframe id="output3"></iframe>
<h3>IV. Grayscale</h3>
<p><strong>Explanation:</strong> <code>grayscale()</code> filter element ko black-and-white banata hai.</p>
<textarea id="code4">
<style>
.grayscale {
filter: grayscale(100%);
}
</style>
<img class="grayscale" src="image.jpg" alt="Grayscale Image">
</textarea>
<button onclick="runCode('code4', 'output4')">Run Code</button>
<iframe id="output4"></iframe>
<h3>V. Sepia</h3>
<p><strong>Explanation:</strong> <code>sepia()</code> filter element ko purani ya vintage look dene ke liye use hota hai.</p>
<textarea id="code5">
<style>
.sepia {
filter: sepia(100%);
}
</style>
<img class="sepia" src="image.jpg" alt="Sepia Image">
</textarea>
<button onclick="runCode('code5', 'output5')">Run Code</button>
<iframe id="output5"></iframe>
<h3>VI. Hue-rotate</h3>
<p><strong>Explanation:</strong> <code>hue-rotate()</code> filter element ke colors ko rotate (shift) karta hai.</p>
<textarea id="code6">
<style>
.hue-rotate {
filter: hue-rotate(90deg);
}
</style>
<img class="hue-rotate" src="image.jpg" alt="Hue-Rotated Image">
</textarea>
<button onclick="runCode('code6', 'output6')">Run Code</button>
<iframe id="output6"></iframe>
<h3>VII. Invert</h3>
<p><strong>Explanation:</strong> <code>invert()</code> filter element ke colors ko reverse (invert) karta hai.</p>
<textarea id="code7">
<style>
.invert {
filter: invert(100%);
}
</style>
<img class="invert" src="image.jpg" alt="Inverted Image">
</textarea>
<button onclick="runCode('code7', 'output7')">Run Code</button>
<iframe id="output7"></iframe>
<h3>VIII. Drop-shadow</h3>
<p><strong>Explanation:</strong> <code>drop-shadow()</code> filter element ke neeche shadow add karta hai.</p>
<textarea id="code8">
<style>
.drop-shadow {
filter: drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.3));
}
</style>
<img class="drop-shadow" src="image.jpg" alt="Image with Drop Shadow">
</textarea>
<button onclick="runCode('code8', 'output8')">Run Code</button>
<iframe id="output8"></iframe>
</div>
<script>
function runCode(textareaId, iframeId) {
const code = document.getElementById(textareaId).value;
const iframe = document.getElementById(iframeId);
const doc = iframe.contentDocument || iframe.contentWindow.document;
doc.open();
doc.write(code);
doc.close();
}
</script>
</body>
</html>