
- SVG 演示
- SVG - 載入器
- SVG - 對話方塊
- SVG - 圖示
- SVG - 時鐘
- SVG - 拖動
- SVG - 關鍵點
- SVG - 地圖
- SVG - amChart
- SVG - 圖表
- SVG - 平面著色
- SVG - 影像濾鏡
- SVG - 文字效果
- SVG - 使用 CSS 效果的文字
- SVG - 箭頭效果
- SVG - 品牌效果
- SVG - 膠狀效果
- SVG - 漸變效果
- SVG - 活潑效果
- SVG - 滾動效果
- SVG - 幻燈片效果
- SVG - 標籤效果
- SVG - Raphael.js 效果
- SVG - Velocity.js 效果
- SVG - Walkway.js 效果
- SVG - zPath.js 效果
- SVG - Vague.js 效果
- SVG - 變換效果
- SVG - 全屏覆蓋效果
- SVG - Lazylinepainter.js 效果
- SVG - 演示遊戲
- SVG - 即時 SVG 廣告
- SVG 有用資源
- SVG - 常見問題解答
- SVG - 快速指南
- SVG - 有用資源
- SVG - 討論
SVG - 文字
<text> 元素用於繪製文字。
宣告
以下是<text>元素的語法宣告。我們只顯示了主要屬性。
<text x="x-cordinates" y="y-cordinates" dx="list of lengths" dy="list of lengths" rotate="list of numbers" textlength="length" lengthAdjust="spacing" > </text>
屬性
序號 | 屬性和描述 |
---|---|
1 | x − 字形的 x 軸座標。 |
2 | y − 字形的 y 軸座標。 |
3 | dx − 沿 x 軸的偏移。 |
4 | dy − 沿 y 軸的偏移。 |
5 | rotate − 應用於所有字形的旋轉。 |
6 | textLength − 文字的渲染長度。 |
7 | lengthAdjust − 對文字渲染長度的調整型別。 |
示例
testSVG.htm<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="800" height="800"> <g> <text x="30" y="12" >Text: </text> <text x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM</text> </g> </svg> </body> </html>
輸出
在 Chrome 瀏覽器中開啟 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接檢視 SVG 圖片,無需任何外掛。Internet Explorer 9 及更高版本也支援 SVG 圖片渲染。
帶有旋轉的文字
<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="800" height="800"> <g> <text x="30" y="12" >Multiline Text: </text> <text x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM <tspan x="30" y="50" font-weight="bold">Simply Easy learning.</tspan> <tspan x="30" y="70">We teach just for free.</tspan> </text> </g> </svg> </body> </html>
輸出
在 Chrome 瀏覽器中開啟 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接檢視 SVG 圖片,無需任何外掛。Internet Explorer 9 及更高版本也支援 SVG 圖片渲染。
多行文字
<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="570" height="100"> <g> <text x="30" y="12" >Multiline Text: </text> <text x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM <tspan x="30" y="50" font-weight="bold">Simply Easy learning.</tspan> <tspan x="30" y="70">We teach just for free.</tspan> </text> </g> </svg> </body> </html>
輸出
在 Chrome 瀏覽器中開啟 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接檢視 SVG 圖片,無需任何外掛。Internet Explorer 9 及更高版本也支援 SVG 圖片渲染。
超連結文字
<html> <title>SVG Text</title> <body> <h1>Sample SVG Text</h1> <svg width="800" height="800"> <g> <text x="30" y="10" >Text as Link: </text> <a xlink:href="https://tutorialspoint.tw/svg/" target="_blank"> <text font-family="Verdana" font-size="20" x="30" y="30" fill="rgb(121,0,121)">WWW.TutorialsPoint.COM</text> </a> </g> </svg> </body> </html>
輸出
在 Chrome 瀏覽器中開啟 textSVG.htm。您可以使用 Chrome/Firefox/Opera 直接檢視 SVG 圖片,無需任何外掛。Internet Explorer 9 及更高版本也支援 SVG 圖片渲染。
廣告