在 HTML5 中如何在 SVG 圓內顯示影像?
要在 SVG 圓中顯示影像,請使用 <circle> 元素並設定剪下路徑。<clipPath> 元素用於定義剪下路徑。SVG 中的影像使用 <image> 元素設定。

示例
可以嘗試執行以下程式碼以瞭解如何在 HTML5 中在 SVG 圓內顯示影像
<!DOCTYPE html> <html> <head> <title>HTML5 SVG Image</title> <head> <body> <svg width="500" height="350"> <defs> <clipPath id="myCircle"> <circle cx="250" cy="145" r="125" fill="#FFFFFF" /> </clipPath> </defs> <image width="500" height="350" xlink:href="https://tutorialspoint.tw/videotutorials/images/coding_ground_home.jpg" clip-path="url(#myCircle)" /> </svg> </body> </html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP