CSS Clip-Path 속성 소개
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CSS Clip-Path: Shaping Web Elements</title> <style> body { font-family: sans-serif; } .container { display: flex; justify-content: center; align-items: center; min-height: 100vh; } .intro-image { width: 500px; height: auto; } .section-title { font-size: 1.5em; font-weight: bold; margin-bottom: 1em; } .code-example { background-color: #f0f0f0; padding: 1em; border-radius: 5px; margin-bottom: 1em; overflow-x: auto; /* Add horizontal scroll if needed */ } .code-example pre { margin: 0; } .image-example { display: flex; justify-content: center; align-items: center; margin-bottom: 2em; } .image-example img { max-width: 100%; height: auto; } .key-takeaway { margin-bottom: 2em; } .key-takeaway ul { list-style-type: disc; padding-left: 20px; } .faq-section { margin-top: 3em; } .faq-section h2 { font-size: 1.8em; font-weight: bold; margin-bottom: 1em; } .faq-section .faq-item { margin-bottom: 1em; } .faq-section .faq-item h3 { font-weight: bold; margin-bottom: 0.5em; } </style> </head> <body> <div class="container"> <img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/174009775169997.jpg" class="lazy" alt="Introducing the CSS clip-path Property " /> </div> <p>The web's predominantly rectangular layout contrasts with print media's diverse shapes. This difference stems partly from a lack of suitable tools. This tutorial introduces <code>clip-path</code>, a CSS property offering the design flexibility of print.</p> <div class="key-takeaway"> <h2 id="Key-Takeaways">Key Takeaways</h2> <ul> <li><code>clip-path</code> masks parts of an element, exceeding the limitations of the deprecated <code>clip</code> property (rectangular clipping only).</li> <li>It supports basic shapes, geometry boxes, or SVG <code><clippath></code> URLs for complex shapes and animations.</li> <li>Animating <code>clip-path</code> requires matching vertex counts in initial and final shapes for smooth transitions.</li> <li>While not universally supported, major modern browsers (Chrome, Safari, Opera) support <code>clip-path</code> (often with prefixes). Firefox support is partial.</li> </ul> </div> <h2 id="The-Basics">The Basics</h2> <p>Clipping trims parts of an element, partially or fully hiding it. The <i>clipping path</i> defines the visible region, whether a simple shape or a complex polygon. The <i>clipping region</i> is the area within this path. Anything outside is hidden, including backgrounds, borders, shadows, and events.</p> <p>Even with non-rectangular elements, surrounding content flows naturally. For shape-aware content flow, use the <code>shape-outside</code> property (see related SitePoint tutorial).</p> <p>Remember: <code>clip-path</code> differs from the limited, deprecated <code>clip</code> property.</p> <h2 id="Syntax-and-Usage">Syntax and Usage</h2> <p>The syntax is: <code>clip-path: <clip-source> | [<basic-shape> || <geometry-box>] | none</code></p> <ul> <li><code><clip-source></code>: An SVG <code><clippath></code> URL.</li> <li><code><basic-shape></code>: Basic shape functions (CSS Shapes spec).</li> <li><code><geometry-box></code>: (Optional) Reference box for <code><basic-shape></code>, or defines the clipping shape itself (e.g., <code>margin-box</code>).</li> </ul> <div class="code-example"> <pre class="brush:php;toolbar:false"><code>img { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }

geometry-box
<code>.clip-me { clip-path: polygon(10% 20%, 20% 30%, 50% 80%) margin-box; margin: 10%; } </code>
를 사용합니다
margin-box
<🎜 🎜> <🎜 🎜>의 사용
<🎜 🎜> <<> 텍스트와 이미지를 향상시킵니다. 복잡한 모양은 쉽게 달성 할 수 있습니다. fill-box
stroke-box
view-box
clip-path
clip-path

<code>.p-msg { clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 75% 85%, 75% 100%, 50% 80%, 0% 75%); } </code>
구문, 플래그를 통해 잠재적으로 활성화). Chrome, Safari 및 Opera에는
접두사가 필요합니다. 최신 정보를 확인할 수 있습니까?<code>.right { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); position: relative; top: -352px; left: 256px; } </code>
CSS Clip-Path 속성은 무엇이며 어떻게 작동합니까?
<🎜 🎜> <<> 디스플레이 영역을 정의하면 요소의 일부를 차단합니다. 기본 모양, 지오메트리 상자 또는 SVG 경로를 허용하여 복잡한 모양과 애니메이션을 가능하게합니다.
clip-path
<code>@keyframes polygons { 25% { clip-path: polygon(20% 0%, 100% 38%, 70% 90%, 0% 100%); } 50% { clip-path: polygon(0 46%, 100% 15%, 55% 74%, 0 100%); } 70% { clip-path: polygon(100% 38%, 100% 38%, 66% 100%, 0 53%); } } </code>
응답 디자인에 CSS 클립 경로 속성을 사용할 수 있습니까?
예, 요소 크기로 스케일링하기 위해 모양 매개 변수의 백분율을 사용하십시오.
animation
위 내용은 CSS Clip-Path 속성 소개의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











다른 날, 나는 Corey Ginnivan의 웹 사이트에서 스크롤 할 때 카드 모음이 서로 쌓이는 것을 발견했습니다.

Google Fonts가 새로운 디자인 (트윗)을 출시 한 것을 볼 수 있습니다. 마지막 큰 재 설계와 비교할 때 이것은 훨씬 더 반복적 인 느낌이 듭니다. 차이를 간신히 말할 수 있습니다

프로젝트에 카운트 다운 타이머가 필요한 적이 있습니까? 그런 것은 플러그인에 도달하는 것이 당연하지만 실제로는 훨씬 더 많습니다.

플렉스 레이아웃의 보라색 슬래시 영역에 대한 질문 플렉스 레이아웃을 사용할 때 개발자 도구 (d ...)와 같은 혼란스러운 현상이 발생할 수 있습니다.

요소 수가 고정되지 않은 경우 CSS를 통해 지정된 클래스 이름의 첫 번째 자식 요소를 선택하는 방법. HTML 구조를 처리 할 때 종종 다른 요소를 만듭니다 ...

새로운 프로젝트가 시작될 때, Sass 컴파일은 눈을 깜박이게합니다. 특히 BrowserSync와 짝을 이루는 경우 기분이 좋습니다.

프론트 엔드 개발에서 Windows와 같은 구현 방법 ...
