HTML5 svg 2D Getting Started 3-text and images and rendering text introduction

Source: Internet
Author: User

Render text in SVG

One of the power of SVG is that it can control text to a standard HTML page without having to ask for images or other plugins. Any action that can be performed on a shape or path, such as a drawing or a filter, can be performed on the text. Although SVG's text rendering is so powerful, there is one disadvantage: SVG cannot perform line wrapping. If the text is longer than the allowable space, simply cut it off. In most cases, multiple text elements are required to create multiple lines of text. The best hospital www.pf0412.cn in the treatment of vitiligo in Anshan

In addition, you can use the Tspan element to divide text elements into parts, allowing each section to have its own style.

Also, in the text element, whitespace is treated like HTML: line breaks and carriage returns become spaces, and multiple spaces are compressed into a single space.

Text that appears directly in the picture-text element

As shown in the example above, the text element can set the following properties:

X, y is the text position coordinates. Text-anchor is the direction in which the text is displayed, in fact the position (x, y) is in the text position. This property has Start,middle and end three values. Start indicates that the text position coordinates (x, y) are at the beginning of the text, and the text appears from this point to the right. Middle indicates that (x, y) is in the middle of the text and the text is displayed in the left and right two directions, in fact centered. End indicates that the (x, y) point is at the end of text and text appears to the left. Anshan Dermatosis Hospital www.pf0412.cn

In addition to these properties, the following properties can be specified either in CSS or directly in properties:

Fill,stroke: Fill and stroke colors, which are summarized later. Properties related to font: font-family, Font-style, Font-weight, Font-variant, Font-stretch, Font-size, Font-size-adjust, kerning, Letter-spacing, Word-spacing and Text-decoration.

Text Interval-Tspan element

This element is a powerful complement to the text element, which is used to render text within a range, which can only appear in a text element or a child element of a tspan element. A typical use is to emphasize the display of some text.

HTML5 svg 2D Getting Started 3-text and images and rendering text introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.