CSS گلاس مورفزم جنریٹر

استعمال کا طریقہ 3 مراحل
  1. بلر، رنگت کی دُھندلاہٹ، سیرابی اور رنگت کا رنگ ایڈجسٹ کریں۔
  2. کونے کا رداس اور کنارے کی شدت طے کریں؛ پیش منظر ساتھ ساتھ بدلتا ہے۔
  3. Glassmorphism کا CSS نقل کریں دبائیں اور اپنی اسٹائل شیٹ میں چسپاں کریں۔
شیشے کے پینل کا پیش منظر
تیار کردہ CSS کوڈ

یہ ٹول کیسے کام کرتا ہے

یہ تاثر ایک ہی خصوصیت کے دم پر ہے: backdrop-filter فلٹر کو عنصر پر نہیں بلکہ اس کے پیچھے جو کچھ ہو اس پر لگاتا ہے۔ اس پس منظر کو دھندلا کریں، اوپر جزوی طور پر شفاف رنگت بچھا دیں، اور پینل دُھند آلود شیشے کی طرح پڑھا جانے لگتا ہے۔ سیرابی کا اضافہ وہ حصہ ہے جو عموماً چھوڑ دیا جاتا ہے اور جو سب سے زیادہ اہمیت رکھتا ہے — اس کے بغیر دھندلا پس منظر گدلا ہو جاتا ہے اور نتیجہ شیشے کے بجائے کہر جیسا لگتا ہے۔

رنگت ایک رنگ اور دُھندلاہٹ کو ملا کر بنی rgba قدر ہے، اور ایک ہلکا روشن بارڈر شیشے کے کنارے کا تاثر مکمل کرتا ہے۔ ایک سخت شرط یہ ہے کہ پینل کے پیچھے کچھ ہونا چاہیے: سادہ رنگ پر دھندلانے کو کچھ نہیں ہوتا اور تاثر غائب رہتا ہے، اور نقل کیے ہوئے glassmorphism اصول کے کچھ نہ کرنے کی سب سے بڑی وجہ یہی ہے۔

قیمتیں، جو حقیقی ہیں

  • پیچھے کچھ نہ ہو تو دھندلانے کو کچھ نہیں: والد عنصر کو تصویر، گریڈینٹ یا اوپر تلے آتا ہوا مواد چاہیے۔ سادہ پس منظر پر پینل محض ایک رنگا ہوا مستطیل ہے۔
  • عبارت کا تضاد دھندلے پس منظر کے مقابل ناپا جاتا ہے: اور وہ پس منظر صفحہ اسکرول ہونے کے ساتھ بدلتا ہے، اس لیے جو سرخی اوپر پڑھی جا سکتی ہو وہ نیچے جا کر ناکام ہو سکتی ہے۔ رنگت کی دُھندلاہٹ اتنی بڑھائیں کہ بدترین صورت بھی پاس ہو جائے۔
  • اسے بنانا مہنگا ہے: backdrop-filter اس وقت دوبارہ حساب ہوتا ہے جب اس کے پیچھے کوئی چیز ہلے۔ چند پینل ٹھیک ہیں؛ ان کی اسکرول ہوتی فہرست درمیانے درجے کے آلات پر اٹکے گی۔
  • Safari کو ایک عرصے تک سابقے کی ضرورت رہی ہے: معیاری خصوصیت کے ساتھ سابقے والی بھی دی جاتی ہے، اور اسے چھوڑ دینا وہ دوسری عام وجہ ہے جس سے تاثر کچھ لوگوں کے لیے چلتا ہے اور کچھ کے لیے نہیں۔

backdrop-filter blurs what is behind, not what is inside

That one sentence accounts for nearly every report of glassmorphism "not working".

filter applies to the element and its contents. backdrop-filter applies to whatever is behind it. If the parent is a flat colour, there is nothing to blur, and the panel is simply a tinted rectangle. The effect needs an image, a gradient, or overlapping content underneath it to have anything to work with.

The [msm_tool slug="glassmorphism"] previews against a gradient for exactly that reason — on a white page the effect would appear to do nothing.

Saturation is the part everyone leaves out

Blurring a backdrop averages its colours together, and averaging desaturates. Blur alone produces something closer to fog than to glass: soft, but grey and lifeless.

Adding a saturation boost — typically 150% to 200% — pushes the colour back into the blurred backdrop and is what makes the panel read as translucent material rather than as a smudge. It is the difference between the effect looking deliberate and looking like a mistake, and it is a single extra function in the same declaration.

The four parts

  1. The blur — usually 8 to 20 pixels. Below that the backdrop stays legible through the panel, which defeats the point; far above it the backdrop becomes an undifferentiated wash.
  2. The tint — a semi-transparent colour over the blur, typically white at 10–25% on light backdrops, or black at a similar level on dark ones. This is what gives the pane its own presence.
  3. The saturation — the part above.
  4. The border — a faint light line, usually white at 20–40%. Real glass catches light at its edge, and without it the panel has no defined boundary.

The contrast problem, stated plainly

Text on a glass panel sits over a blurred version of whatever is behind it, and that backdrop changes as the page scrolls.

A heading that reads perfectly against the dark part of a hero image can drop below the contrast minimum two hundred pixels further down, where the image is bright. Checking it once at the top of the page is not checking it.

The practical fix is to raise the tint opacity until the worst case passes. That reduces the glass effect — which is the honest trade. If the panel needs to be transparent enough to fail contrast, the text does not belong on it.

It is genuinely expensive

backdrop-filter forces the browser to sample and re-blur the content behind the element whenever anything back there moves. On a static panel over a static background that cost is paid once. On a scrolling page it is paid continuously.

Consequences worth knowing:

  • A few panels are fine. A scrolling list where every row is a glass card will stutter on mid-range hardware, and noticeably on older phones.
  • A sticky glass header over scrolling content is one of the more expensive things you can build, because the backdrop is changing constantly by definition.
  • Battery cost on mobile is real and not something the user can attribute to your page.

Safari and the prefix

Safari required -webkit-backdrop-filter for a long time, and it is still worth emitting both. Dropping the prefixed line is the other common reason the effect works for some visitors and not others — and because it fails silently to a plain tinted rectangle, nobody reports it as broken.

When to use it, and when not

Glass works where it is doing a job: a navigation bar that needs to sit above content without hiding it, a modal that should keep its context visible, an overlay on a photograph.

It works badly as decoration on a plain page, where there is nothing to blur, and badly on anything that must be read carefully, because the backdrop is competing with the text by design. If in doubt, a solid panel at 95% opacity gives most of the layering and none of the cost.

اکثر پوچھے گئے سوالات

خاص طور پر CSS گلاس مورفزم جنریٹر کے بارے میں۔ اس زمرے سے متعلق عمومی سوالات کے جواب زمرے کے صفحے پر موجود ہیں۔

پینل کے پیچھے دھندلانے کو کچھ نہیں ہے۔ backdrop-filter کو والد عنصر میں تصویر، گریڈینٹ یا اوپر تلے آتا مواد چاہیے؛ سادہ رنگ پر یہ غائب رہتا ہے۔
یہ دھندلے پس منظر کے رنگ کو تیز کرتی ہے۔ اس کے بغیر دھندلاہٹ رنگ دھو دیتی ہے اور پینل شیشے کے بجائے کہر جیسا پڑھا جاتا ہے۔
صرف اسی صورت میں جب آپ جانچ لیں۔ تضاد دھندلے پس منظر کے مقابل ہوتا ہے، جو اسکرول کے ساتھ بدلتا ہے — رنگت کی دُھندلاہٹ اتنی بڑھائیں کہ بدترین صورت پاس ہو۔
جی ہاں، زیادہ تر تاثرات سے زیادہ۔ جب بھی اس کے پیچھے کچھ ہلتا ہے یہ دوبارہ بنتا ہے، اس لیے اسے اسکرول ہوتی فہرست کے بجائے چند پینل تک رکھیں۔
سابقے والی سطر Safari کے لیے ہے، جسے ایک عرصے تک اس کی ضرورت رہی۔ اسے چھوڑ دینا وہ وجہ ہے جس سے تاثر کچھ لوگوں کے لیے چلتا ہے اور کچھ کے لیے نہیں۔

نئے ٹولز، خصوصیات اور کارکردگی بڑھانے کے مشوروں کی اطلاع پانے کے لیے سبسکرائب کریں۔