کلپ پاتھ جنریٹر

استعمال کا طریقہ 3 مراحل
  1. شکل چنیں۔
  2. سائز، مرکز اور کونوں کی گولائی طے کریں؛ پیش منظر ساتھ ساتھ بدلتا ہے۔
  3. CSS کاپی کریں دبائیں اور اپنی اسٹائل شیٹ میں چسپاں کریں۔
دائروں کے لیے رداس، مستطیلوں کے لیے اندرونی گہرائی، مقررہ کثیر الاضلاع میں نظر انداز۔
صرف اندرونی مستطیل پر لاگو ہوتا ہے۔
تیار کردہ CSS

ہر جگہ پکسل کے بجائے فیصد استعمال ہوتے ہیں، اس لیے شکل عنصر کے ساتھ سائز بدلتی ہے بجائے اس کے کہ کسی دوسرے سائز پر بگڑ جائے۔ کلپ شدہ عنصر لے آؤٹ کے لیے اپنا پورا باکس گھیرے رکھتا ہے اور پوائنٹر ایونٹس صرف نظر آنے والے حصے کے اندر ہی وصول کرتا ہے۔ جو کچھ کلپ ہو کر ہٹتا ہے وہ چھپتا ہے، حذف نہیں ہوتا، اس لیے بامعنی مواد کناروں سے دور رکھیں۔

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

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

متناسقات عنصر کے اپنے ڈبے کے فی صد ہیں، اسی لیے شکلیں مقررہ سائز کی محتاج ہوئے بغیر اس کے ساتھ بڑھتی گھٹتی ہیں۔ inset شکل آپ کے سائز کو ہر کنارے کے لیے آدھا کرتی ہے اور اس مقام سے ذرا پہلے رک جاتی ہے جہاں چاروں کنارے مل کر عنصر کو پورا تراش دیتے۔ آؤٹ پُٹ دو بار دیا جاتا ہے، ایک بار WebKit کے سابقے کے ساتھ، جو پرانا Safari اب بھی مانگتا ہے۔

تراشنا کیا بدلتا ہے اور کیا نہیں

  • لے آؤٹ متاثر نہیں ہوتا: عنصر اپنا پورا مستطیل گھیرتا ہے۔ ساتھ کا مواد نظر آنے والی شکل کے بجائے ڈبے کے گرد بہتا ہے، اس لیے متن کے پہلو میں رکھا ہوا تراشا عنصر ایک مستطیل خلا چھوڑ دیتا ہے۔
  • تراش ایک سخت کنارہ ہے، دھندلاہٹ نہیں: سرحد پر نہ کوئی نرمی ہوتی ہے نہ جزوی شفافیت۔ ترچھے کنارے براؤزر ہموار کر دیتا ہے، مگر شکل بذاتِ خود دو رخی ہے۔
  • گولائی کا اختیار صرف inset پر لاگو ہوتا ہے: کثیر الاضلاع اور دائرے کی شکلوں میں گول کرنے کے لیے کوئی کونہ ہی نہیں، اس لیے وہ سلائیڈر تب تک کچھ نہیں کرتا جب تک آپ inset پر نہ جائیں۔
  • مواد چھپایا جاتا ہے، ہٹایا نہیں جاتا: نظر سے تراشا ہوا متن دستاویز میں موجود رہتا ہے اور معاون ٹیکنالوجی اسے پھر بھی پڑھتی ہے۔ جو چیز سنائی نہیں دینی چاہیے، اسے چھپانے کے لیے clip-path استعمال نہ کریں۔

Painting, not cropping

A clip path defines the region of an element that gets painted. Everything outside it is not drawn. Nothing is cropped, resized or removed — the element keeps its full size in the layout and still occupies its whole rectangle.

That distinction accounts for most of the surprise. A clipped element sitting beside a paragraph leaves a rectangular gap, because neighbouring content flows around the box rather than around the visible shape. If you want text to wrap to the shape, that is shape-outside, a separate property that happens to take the same values.

The [msm_tool slug="clip-path-generator"] covers polygons, circles, ellipses and insets, with the coordinates as percentages so the shape scales with the element.

Percentages, and why they matter

Coordinates are percentages of the element's own box. A polygon defined that way holds its proportions whatever size the element becomes, which is what makes clip paths usable in responsive layouts.

Pixel coordinates are legal and almost always wrong for this reason: a shape tuned at 800 pixels wide is a different shape at 320, and usually a broken one.

The hard edge

Clipping is binary. There is no feathering and no partial transparency at the boundary — a pixel is either painted or it is not. Diagonal edges are antialiased by the browser so they do not look jagged, but the shape itself has no soft falloff.

If you want a gradual fade, that is a mask rather than a clip. mask-image with a gradient does what people often expect clip-path to do.

Animating between shapes

Two polygons with the same number of points interpolate smoothly, and browsers handle it well. That is how the sliding diagonal reveals and morphing shapes in modern hero sections are built.

Two polygons with different point counts do not interpolate — the change is abrupt. The workaround is to give both shapes the same number of points and place the surplus ones on top of each other, so a triangle described with six points can morph into a hexagon.

Different shape functions never interpolate. A circle does not animate into a polygon.

Content is hidden, not removed

Text clipped out of view is still in the document and still read aloud by a screen reader. So are links, which remain focusable and can send a keyboard user to a part of the page they cannot see.

Never use a clip path to hide something that should not be announced. If content should be gone, remove it, or use display: none or the hidden attribute. Clipping is a visual operation only.

The same applies to pointer events: the clipped-away region stops receiving them, which is usually helpful, but it means a button clipped in half only responds on the visible portion.

The common uses

  • Angled section dividers. A polygon on a section with a slanted top or bottom edge, replacing the older technique of a rotated pseudo-element or a background SVG.
  • Circular avatars. Though border-radius: 50% is simpler and better supported for that specific case.
  • Reveal animations. An inset that starts at full coverage and animates open.
  • Non-rectangular images without producing a transparent PNG for every shape.

The rounding option only applies to inset

Polygons and circles have no corners to round, so the rounding control does nothing until you switch to the inset shape. That is not a limitation of the tool; the CSS round keyword is only valid within inset().

The prefix

The value is emitted twice, once with the WebKit prefix, which older Safari versions still require. Current browsers use the unprefixed property, and there is no cost to shipping both.

What to check

Resize the element. A shape that looks right at one width and collapses at another is the commonest fault, and percentage coordinates make it far less likely but do not eliminate it — an extreme aspect ratio can still distort a polygon into something unintended.

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

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

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

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