Butt from vikoristanny SVG. SVG: basics of vector graphics in HTML Svg html application

To enhance the image on the page, use a tag . This tag contains a mandatory parameter: SRC="" and a number of non-binding parameters. The SRC="" parameter tells the browser the address to search for the little ones and how the value is related to the URL of the resource hosted graphic file. In the simplest case, this file will be located in the root directory or the IMG folder of your site. Necessary language parameters:

The ALT="" parameter is important to place the text, which indicates the replacement of the image for those browsers that do not support graphics or use the disabled graphics mode. This message appears when you hover the bear's pointer over the image.

The parameters WIDTH="" HEIGHT="" represent the dimensions of the image based on the width and height in pixels. These parameters should be indicated in the code of the page so that the browser will later deprive the space for the image, so that the page will be less “cluttered”. On the other hand, these parameters can be used to better regulate the size of the baby in the browser window.

The BORDER="" parameter describes the border around the image. The value is indicated by a number that indicates the width of the frame in pixels.

The ALIGN= parameter indicates the position of the image on the side, and you can take the following values: TOP - the top line of the image is behind the highest element of the flow line, TEXTTOP - the top line of the image is behind the next text element of the flow line, MIDDLE - the top line the middle of the image along the base line of the production row. , ABSMIDDLE – the vertical middle of the image in the middle of the production row. BASELINE or BOTTOM—virtual bottom boundary of the image along the base line of the flow row, ABSBOTTOM—virtual bottom boundary of the image along the bottom boundary of the flow row, HSPACE=—indicates the horizontal approach, VSPACE=—indicates the horizontal approach verticals.

Tag syntax:

Bizhuchiy row

The row to run is specified by the tag .

The attributes of this tag are bgcolor - the color of the background of the row to run, height - the height of the row, width - the width of the row.

Direction - sets the direction of the row to run - direction="left" (right, up, down) - move to the left (right, uphill, down).

Behavior - row behavior - behavior = "scroll" (slide, alternate). Scroll - primary scrolling (you don’t have to write it down, that’s how it’s done)



Slide - scrolling with a gap, the row runs to the edge and stops. If you select the loop parameter with behavor="slide" at the same time, the row will be scrolled a number of times and will be closed on the edge. Alternate - the row collapses from edge to edge.
Scrollamount - the speed of the row, scrollamount = "1". You can take values ​​from 1 to 10. 1 is the most advanced, 10 is the most advanced.

Tag syntax: text

Current web browsers can create videos sound files different formats. For this reason, use new players (plug-in, ActiveX elements) or external player programs. You can insert sound or video into an HTML document using the following tags:

- to insert background sound;

- to insert video into AVI format;

- to insert audio and video files;

- for inserting audio and video files.

If you prefer, insert the audio and/or video into the HTML document, ensuring that the related files can complete the entire process. The most popular files on the Internet are the audio formats MP3, WMA, AIFF, AU, RealAudio (with extensions ra and ram), MP4, MIDI and video formats MPEG, MOV. The WAV audio format and the AVI video format are rarely available on the Internet.

HTML images available on web pages for additional tag . Vikoristan graphics make web pages visually appealing. Images help better convey the essence of a web document.

For more help with HTML tags і can be closed picture-card with active galuzami.

Inserting an image into an HTML document

1. Tag

element represents the image and its backup content, which is provided by the additional alt attribute. Splinters of element However, it is recommended to expand it in the middle of the block element, for example,

Abo

.

Tag The obligatory attribute src has values ​​that are absolute or relative to the image:

For tag The following attributes are available:

Table 1. Tag attributes
Attribute Description, accept the meaning
alt The alt attribute provides alternative text for the image. Displayed on the spot where the image appears before you click or when you turn on the schedule, and also appears as a hint when you hover your mouse over the image.
Syntax: alt=" image description" . !}!}
crossorigin The crossorigin attribute allows you to import images from resources of another domain using CORS requests. Images imported into the canvas using CORS requests can be re-vikted. Acceptable values:
anonymous - Cross-origin will be followed by an additional HTTP header, in which case data will not be transmitted. Since the server does not provide cloud data to the server from which the content is retrieved, the images will be zipped and the content will be framed.
use-credentials — Cross-origin is associated with the transfer of cloud data.
Syntax: crossorigin="anonymous" .
height The height attribute indicates the height of the image. You can use px or %.
Syntax: height: 300px.
ismap The ismap attribute indicates those images that are part of the image-map rendered on the server (image-map - images with interactive areas). When you press an image onto the map, the coordinates are transmitted to the server in a row with a URL. The ismap attribute is only allowed in the form of an element є on the element with an active href attribute.
Syntax: tse map.
longdesc The URL of a rich description of the image, which is complemented by the alt attribute.
Syntax: longdesc="http://www.example.com/description.txt".
src The src attribute specifies the path to the image.
Syntax: src="flower.jpg".
sizes Sets the image size according to the display parameters. Works best when the srcset attribute is specified. The attribute values ​​have one or a number of rows, indicated through a coma.
srcset Creates a list of images that will be selected from a separate part of the screen. You can use it at once or replace the src attribute. The attribute values ​​have one or a number of rows separated by one.
usemap The usemap attribute designates the image as an image-map. The meaning must begin with the # symbol. The values ​​are associated with the values ​​of the name attribute and the tag id it creates connections between elements і . The attribute cannot be vicorized as an element є on the element or else
width The width attribute indicates the width of the image. You can use px or %.
Syntax: width: 100%.

1.1. Image addresses

Image addresses can be entered in full (absolute URL), for example:
url (http://anysite.ru/images/anyphoto.png)

Or through the waterway document or else root directory website:
url(../images/anyphoto.png) - the main path to the document,
url(/images/anyphoto.png) - the main path to the root directory.

This is interpreted as follows:
../ - means go up the hill one level, to the root directory,
images/ - go to the folder containing images,
anyphoto.png - indicates an image file.

1.2. Image size

Without specifying the size, the images of the babies are displayed on the page in real size. You can adjust the size of the image using the additional attributes width and height. If tasks lack one of the attributes, the other will be calculated automatically to save baby proportions.

1.3. Graphic file formats

JPEG format (Joint Photographic Experts Group). JPEG images are ideal for photographs and can contain millions of different colors. Squeezing images like GIFs, but text and large areas with a strong color can be covered in flames.

GIF format (Graphics Interchange Format). Ideal for embossing images, such as in areas of color, such as logos. GIF files allow you to set one of the colors clearly, so that the background of the web page can appear through part of the image. GIF files can also include simple animation. GIF images have less than 256 views, which makes the images look flat and have an unrealistic color, like crying.

PNG format (Portable Network Graphics). Includes beautiful pictures of GIF and JPEG formats. There are 256 colors available and it gives you the ability to create one of the colors to be transparent, which compresses the image into a smaller size, a smaller GIF file.

APNG format (Animated Portable Network Graphics). PNG-based image format. Allows you to save animation and also promote clarity.

SVG format (Scalable Vector Graphics). SVG-little ones are made up of a set of geometric shapes described in XML format: line, ellipse, orgy, etc. Both static and animated graphics are shown. The range of features includes various transformations, alpha masks, filter effects, and the ability to change templates. Images in SVG format can be changed in size without reducing the brightness.

BMP format (Bitmap Picture). It is an undisturbed (original) raster image, the template of which is a rectangular grid of pixels. The bitmap file consists of a title, a palette and graphic data. The header stores information about the graphic image and file (pixel depth, height, width and number of colors). The palette is indicated only in these Bitmap files, which consist of palette images (8 or less bits) and consist of no more than 256 elements. Graphic data represents the picture itself. The color depth in this format can be 1, 2, 4, 8, 16, 24, 32, 48 bits per pixel.

ICO format (Windows icon). Format for saving pictogram files in Microsoft Windows. Also, Windows icon is used as an icon on websites on the Internet. The image itself in this format is displayed in order with the website address or bookmark in the browser. One ICO file contains one or a number of icons, the size and color of the skin is set separately. The size of the icon can be anything but large square icons with sides of 16, 32 and 48 pixels.

2. Tag

Tag serve to present a graphical image as a map with active areas. Active areas are indicated by changing the appearance of the mouse cursor when hovered. By clicking the target on the active areas, the user can move on to the linked documents.

For the accessibility tag, the name attribute indicates the name of the card. The value of the name attribute for the tag There may be a name in the element's usemap attribute :

...

element take revenge on low elements , which means the interactive areas of the map image.

3. Tag

Tag describes only one active area in the card storage area for a client. The element does not contain the tag that it covers. If one active area overlaps another, the first step in the list of areas will be implemented.

Table 2. Tag attributes
Attribute Short description
alt Sets alternative text for the active area of ​​the card.
coords Indicates the position of the area on the screen. Coordinates are specified in units of dovzhin and divided by comas:
For cola- coordinates to the center and radius of the stake;
For orthocutaneous- coordinates of the upper left and lower right corners;
For oregano- the coordinates of the vertices of the origami in the required order, it is also recommended to indicate the remaining coordinates, equal to the first ones, for the logical completion of the figure.
download The addition of the href attribute informs the browser that the resource will be clicked when the user clicks on the message, rather than, for example, opening it (like a PDF file) first. By specifying a name for an attribute, we thus assign a name to the object that will be attracted. It is allowed to select an attribute without assigning its value.
href Instruct the URL to be sent. It can either be specified in absolute form or in the specified address of the postal address.
hreflang This means the language associated with the web document. Vikorist is often used with the href attribute. The meaning that is accepted is an abbreviation that is made up of a pair of letters that indicate the language code.
media This means that the file will be optimized for certain types of devices. The meanings can be any kind of media.
rel The href attribute is supplemented with information about the relationship between the exact and linked document. Significance of what to take:
alternate - sending to an alternative version of the document (for example, a different side form, a translation or a mirror).
author – permission for the author of the document.
bookmark - a URL address that is used for bookmarks.
help – sent for follow-up.
license — a message about copyright information for this web document.
next/prev—indicates connections between adjacent URLs. Once again, Google's findings may indicate that the pages are linked in a logical order.
nofollow – blocks the search system from following messages on this page or following specific messages.
noreferrer - Indicates that when referring to a request, the browser is not required to overload the HTTP request header (Referrer), which records information about which side of the page the visitors are referring to the site from.
prefetch - Indicates that the target document is guilty of caching, etc. The browser in the background will import the pages into the cache.
search - indicates that the target document is a search tool.
tag – specifies a keyword for the flow document.
shape Sets the shape of the active area on the map and its coordinates. You can take the following values:
rect - rectangular shaped area is active;
circle – active area near the stake shape;
poly - active area of ​​the oregano form;
default – the active area occupies the entire image area.
target Indicates where the document will be taken before the hour of transfer. It takes the following values:
_self — the side will be viewed exactly;
_blank - the page opens in a new browser window;
_parent - the side will be admired by the frame-father;
_top - the side will be displayed outside the browser window.
type Specify the MIME type of the sent files, then. file extension.

4. Butt of the picture-image folding

1) The output image of the active region of the required shape is marked. The coordinates of the areas can be calculated using additional photo processing programs, for example, Adobe Photoshop or else Paint.


Small 1. Butt of marking the image for the folded card

2) Set the name of the card that added it to the tag for more information about the name attribute. This value is assigned to the usemap attribute of the tag .

Jpg" alt="flowers_foto" width="680" height="383" usemap="#flowers"> !} !} gerbera hyacinth camomiles tulip
Small 2. An example of a created image card, when you press the mouse cursor on the card, you will go to the page with a description

This post is the first in a series of articles about SVG (Scalable Vector Graphic), which explains the basics of vector graphics on the site.

Vector graphics are widely used in printing. For websites, the original SVG is the official specification on w3.org. mine to describe two-dimensional graphics in XML. SVG includes three types of objects: shapes, images, and text. SVG has been around since 1999 and has been included in the W3C recommendation since September 16, 2011. SVG is already underestimated by web developers, although it has a number of important advantages.

Advantages SVG

Basic SVG shapes

Based on the official specification, you can draw simple objects using an additional SVG: rectum, colo, line, ellipse, laman line, or rich cutlet using an additional tag svg.

Simple line for additional tag line with two parameters - points on the cob (x1 and x2) and end (y1 and y2):

You can also add attributes or stroke and stroke-width styles to set the color and width:

Style="stroke-width:1; stroke:rgb(0,0,0);"

Lamana line

The syntax is similar to the previous one, the tag is vikoriated polyline, attribute points sets points:

Strawberry

When clicked with the rect tag, you can add the following attributes:

Circumference

Click on tag circle, at the butt for additional attribute r set the radius, cxі cy set the coordinates to the center:

Elips

Click on tag ellipse, works similarly circle, but you can specify two radii - rxі ry:

Bagatokutnik

Click on tag polygon, the rich-coat can be divided into a number of sides:

Editors' Wikoristanny

As you can see from the examples, painting basic SVG shapes is not very simple, but objects can be highly complex. For these, you need to use vector graphics editors, such as Adobe Illustrator or Inkscape, where you can save files in the SVG format, and then edit them in a text editor. You can insert SVG on the side using embed, iframe and object:

Example - image of an iPod from the site OpenClipArt.org.

Vector graphics are widely used among other products. As a website, we can also use vector graphics as SVG or Scalable Vector Graphics. The official W3.org specification describes it as follows:

A language for describing two-dimensional graphics using XML. SVG allows you to create three types of graphic objects: vector graphic shapes (for example, shapes that consist of straight and curved lines), images and text.

The technology has been available since 1999, and on September 16, 2011 it reached the list of W3C recommendations. Tim no less, SVG is still not used very often, despite the obvious advantage of using vector graphics instead of raster ones.

Advantages of scaled vector graphics

From the point of view of graphics on the pages of a website, scaled vector graphics show us several advantages over raster graphics, which include:

Independence by permission

Raster graphics (or Bitmap) are stored separately, and are created using additional pixels. If such a graphic element is increased in size, then large squares will immediately become visible. This is not possible with vector graphics, because it cannot be allowed to remain, and it is forced to mathematical calculations What allows us to increase it to any size and not waste it in jeopardy.

Shortening HTTP requests

Vector graphics that scale can be embedded directly into an HTML document using the svg tag, so that the browser does not need an additional input for the graphics. This also has a positive impact on the productivity of the website.

Stylization and scripting

Direct integration using svg svg also allows us to style graphics using additional CSS. We can change object parameters such as background color, blur, borders, and so on, just as they are in HTML. We can also use graphics using JavaScript.

Possibility of animation and editing

An SVG object can be animated using an animation element or with the help of a JS library using jQuery. The SVG object can also be edited for help. text editor or a graphical PZ for a zrazok (bezkoshtovny) or .

Smaller file size

SVG has a smaller file size compared to raster graphics.

Painting simple figures, vikoryst SVG

Following the specifications, we can draw on the design of rich cutlets, lines, lines or ellipses using SVG and so that the browser generates scaled vector graphics, all graphic elements are responsible for Searched in "svg" tags. Let's take a look at the butts, pointing them lower:

Line

In order to draw a line behind another SVG, we can use the "line" element. This element is designed to draw one straight line, which consists of just two points: the cob and the final one.




As you can see above, the coordinate of the line's starting point is indicated by the first two attributes x1 and x2, and the coordinate of the final point is indicated by the attributes y1 and y2.

There are also two other attributes: stroke and stroke-width, which indicate the color and width of the border. On the other hand, we can also identify these attributes in the row style, as follows:

Style="stroke-width:1; stroke:rgb(0,0,0);"
And this will give us the same result.


*

Lamana line

Here everything already converges with “line”, but behind the additional element “polyline” we can paint a number of lines instead of one. Axle butt:




The "polyline" element contains point attributes that represent all line coordinates.


*

Strawberry

We can paint rectangles as simply as possible, without the addition of the rect element. We will only need to specify the width and height:





*

Circumference

We can also paint a circle behind the circle element. This application has a radius of 100, which is indicated by the r attribute:




The first two attributes, cx and cy, indicate the central coordinate of the stake. At the point of view, we set 102 for the x coordinate and 1 for the y coordinate. If these attributes are not specified, then the default value becomes 0.


*

Elips

We can paint an ellipsis behind the ellipse element. Here everything works approximately the same way as with a stake, but we can also work around the radius of the line x and the radius of the line y for additional attributes rx and ry.





*

Bagatokutnik

Behind the additional element “polygon” we can paint the ornate cutlets, figures with many cuts and sides on the image of the tricutaneous, octocutaneous. Butt:





*

Design of a vector graphics editor

As you can see, it’s easy to paint simple figures using additional SVG HTML. Prote, since we need a foldable object, this method will not suit us.

Fortunately, as we have already said above, we can use the vector graphics editor for Adobe Illustrator or Inkscape in order to create this work. If you are familiar with this software, you can easily draw objects using a manual interface, without additional HTML code.

Or you can create the svg file itself using one of the following elements: embed, iframe, object.


The result will be similar.

U this application we vikoristed z .


*

Browser support for scaled vector graphics

Since there is a lack of support in browsers, scaled vector graphics are now well supported by IE8 and more earlier versions. Alternatively, this can be corrected using an additional JavaScript library called . To make things easier, we use a quick tool to convert our SVG code to the Raphael format.


To get started, download the Raphael.js library from your HTML code. Then upload the svg file to the site, copy and paste the generating code into the next load function:

Window.onload=function() (
//the Raphael code goes here
}
In the middle of the body tag, insert a leading div with the rsr id attribute.


And what did we end up with! Take a look at the butt, aim lower.

On completion

Well, these are the basics of SVG. We are confident that now you will understand this subject a little. This is one of the shortest way Optimize the productivity of your pages, and when you add graphics, they will appear clearly on Retina screens.

As in the past, since we are very thorough, we have prepared for you a small collection of additional articles.

* (Input before SVG)
* (SVG: not subject to permission)
* (Why not vikorize SVG?)

Thank you for reading, and I hope that this article will come to light for you!

Respect! You do not have the right to review the posted text.

Basic concepts and research

The Scalable Vector Graphics (SVG) format is part of a family of vector graphics standards. Vector graphics are differentiated from raster graphics, in which the color of the skin pixel is stored in the entire data array. The most extensive raster formats that are popular on the Internet at the moment are JPEG, GIF and PNG, each of which has its advantages and disadvantages.

Often vikorized shorthand
  • CSS: Cascading Style Sheets
  • GIF: Graphics Interchange Format
  • GUI: Graphical User Interface
  • HTML: Hypertext Markup Language
  • JPEG: Joint Photographic Experts Group
  • PNG: Portable Network Graphics
  • SVG: Scalable Vector Graphics
  • XML: Extensible Markup Language

The SVG format is much superior to any raster format:

  • Graphics in the SVG format are created using a number of mathematical formulas that save much less data in the output file, since there is a need to save data per pixel.
  • Vector images scale better. Trying to increase the scale of images published on the Internet at the same size as the output size may result in distortion (or pixelation) of the image.

    This means that the output pixel data is assigned to a specific image size. When changing the size of the program output, make sure that the data is used to fill the new pixels. Vector images are more stable before scaling; When you change the image size, the following mathematical formulas can be adjusted.

  • The size of the output file for vector graphics is smaller; therefore, graphics in the SVG format are more equal to their raster counterparts and require less transmission channel.
  • Images in the SVG format are rendered by the browser and can be displayed programmatically. The smells of buildings change dynamically, which is why they are especially suitable for data-coated additives, for example, diagrams.
  • The output image file is in SVG format and is presented in a text format, which makes it accessible and friendly for search engines.

From these articles you will learn about the advantages of SVG formats and what they can do to you when creating websites using HTML5.

SVG Basics

When creating a graphic image in the SVG format, a completely different process is required than when creating files. JPEG formats, GIF or PNG. JPEG files, GIF and PNG should be created using any image editing program, for example, Adobe Photoshop. Images in the SVG format are usually created using some kind of XML-based language. It's graphic Koristuvach interfaces Editing graphics in SVG format, which generates the XML code that underlies the image. It's no less important that this information is transferred so that you work directly with XML. Information about programs for editing images in the SVG format can be found in the section.

Listing 1 has butt indications simple XML file SVG, which shows a red circle with a 2-pixel black border.

Listing 1. SVG XML file

The higher code gives the image, showing baby 1.

Malyunok 1. Chervone kolo with a 2-pixel black cordon

Creation of basic geometric shapes

When working with graphics in the SVG format, XML tags are used to create geometric shapes; These XML elements are shown in Table 1.

Table 1. XML elements for creating graphics in the SVG format

line element

The line element is the simplest graphic element. Listing 2 shows how to create a horizontal line.

Listing 2. Creating a horizontal line

The code for hovering over Listing 2 gives an image, showing baby 2.

Figure 2. Simple horizontal line

The root SVG tag has width and height attributes, which indicate the working area available for painting. These attributes work the same way as the height and width attributes of other HTML elements. This option is set so that the work area occupies the entire available space.

In addition, whose application has a style tag. SVG graphics support the combination of styles using advanced techniques. Styles in this article are included so that the images are clearly visible, and when visualizing a baby, the necessary attributes, such as color and width of lines. Additional information You can find out about the definition of styles in SVG graphics in the section.

The designated lines can be created by specifying the end and end coordinates along the X and Y axes. work area. Attributes x1 and y1 are the coordinates of the beginning, and attributes x2 and y2 are the coordinates of the end of the line. To change the direction of the seat line, you just need to change the coordinates. For example, by changing the front butt, you can create a diagonal line, as shown in Listing 3.

Listing 3. Creating a diagonal line

For the little one there are 3 readings, the result of the code given in Listing 3.

Figure 3. Diagonal line

polyline element

Lamana line is a small thing folded from several lines. At Listing 4, the butt of the little creature is pointed, which looks like it’s coming down.

The code for hovering over listing 4 gives an image, showing little 4.

The line is created behind the additional attribute points and the path for assigning pairs of coordinates along the X and Y axes, separated by comas. In the hovered application, the first point is designated as 0.40, where 0 is the coordinate along the X axis, and 40 is the coordinate along the Y axis. However, one set of points is not enough to display the image on the screen, since this set tells the SVG renderer to lose the original position. You need at least two sets of points: cob point and end point(for example, points="0.40 40.40").

As in the case of simple lines, the lines do not necessarily have to be horizontal or vertical. By changing the values ​​from the front butt, you can remove the irregularly shaped figures that are added to the line, as in Listing 5.

Listing 5. Creation of an uneven line

The code for hovering over listing 5 gives an image, showing little 5.

Figure 5. Uneven line

rect element

To create an orthocutaneous plant, you need to measure its width and height, as shown in Listing 6.

Listing 6. Creation of the orthocutaneous

The code for hovering over listing 6 gives an image, showing little 6.

Malyunok 6. Strawberry

You can also create a square using the rect tag; a square is simply a rectangular tree with the same height and width.

circle element

The stake is created by assigning the X and Y coordinates to the center of the stake and the radius, as shown in Listing 7.

Listing 7. Creation of a stake

The code for hovering over listing 7 gives an image, showing little 7.

Malyunok 7. Kolo

Attributes cx and cy indicate the position of the center of the stake of the canvas. Once the radius is set to half the width of the stake, remember that the actual width of the image will be twice as large as the specified value.

Ellipse element

Essentially, an ellipse is the same thing, for which the code specifies two radii, as shown in Listing 8.

Listing 8. Creation of the ellipse

The code for hovering over listing 8 gives an image, showing baby 8.

Malyunok 8. Elips

For this type, the attributes cx and cy are also assigned coordinates to the center of the canvas. However, in the case of an ellipse, you assign one radius for the X axis and another radius for the Y axis, corresponding to the rx and ry attributes.

polygon element

The orchard is a geometric figure that has at least three sides. Listing 9 creates a simple trikutnik.

Listing 9. Creation of the tricutaneous

The code for hovering over listing 9 gives an image, showing little 9.

Malyunok 9. Trikutnik

Similar to the work with the polyline element, rich-cows are created by assigning pairs of coordinates along the X and Y axes using the points attribute.

By adding coordinates along the X and Y axes, you can create a variety of sides. For example, by changing the code of the front butt, you can create a four-sided butt, as shown in Listing 10.

Listing 10. Creation of the four-sided orchard

The code, when hovering over listing 10, gives an image, showing little 10.

Malyunok 10. Four-sided orchard.

Using the polygon tag, you can create geometric shapes with folding shapes. Listing 11 creates a picture of a star.

Listing 11. Creation of the star

The code for hovering over listing 11 gives an image, showing baby 11.

Malyunok 11. Zirchastiy orchardcatcher

path element

The path element, the most complex of all the painting elements, allows you to create more little ones with a different set of special commands. The path element supports the commands listed in Table 2.

Table 2. Commands supported by the path element

These commands can be used in both the upper and lower case. If the command is given at uppercase, Absolute positioning is established. As soon as a team is selected in the lower register, the current position is stagnated. The application of the vikoristan of all commands goes beyond the boundaries of this statistic. Below are a number of examples to demonstrate the basics of the command meaning.

Behind the additional path element, you can create any simple geometric figures of the front applications of this statistic. In Listing 12, behind the help of the path element, an initial trikutnik is created.

Listing 12. Creation of the tricutaneous for help path

The code for hovering on listing 12 gives an image, showing little 12.

Figure 12. Tricutnik, creations behind the additional path element

The list of commands is assigned to the additional attribute d. In this case, the seat starts at the point with coordinates X 150 and Y 0, determined by the command to move to point (M150 0). Then, following the additional command, line the chair to the point (L75 200). a line is drawn to the point with coordinates X = 75 and Y = 200. After this, another line is drawn using another command to draw the line to the point (L225 200). Find the little ones to follow the shutter command (Z). For each coordinate, do not follow the Z command; instead, to freeze the trajectory, draw a line from the flow position back to the exit point of the baby (at this point, the coordinate point is X = 150, Y = 0).

The purpose of the butt was to demonstrate to you the essence of the concept; If you need to create a more basic three-piece, it’s better to quickly use the polygon tag.

The usefulness of the path element is due to its ability to create shapes of non-standard shape, as shown in Listing 13. This example is taken from the World Wide Web Consortium (W3C) document. Scalable Vector Graphics (SVG) 1.1 (another version)(Div. divided).

Listing 13. Creating a non-standard figure using path

The code for hovering over listing 13 gives an image, showing baby 13.

Malyunok 13. Non-standard figure, created behind the help of the path element

Behind the help of the path element, you can create folding little things, for example, diagrams and squiggly lines. The pointed butt has a number of path elements. When creating the little ones, you are not surrounded by any one element of the drawing in the root SVG tag.

Filters and gradients

To supplement the basics CSS styles As has been used in many other applications, SVG graphics also support a variety of filters and gradients. In this section you will learn how to set filters and gradients to small sizes in the SVG format.

Filter

Filters can be used for drying out special effects Before the image is in SVG format. SVG supports such filters.

  • feBlend
  • feColorMatrix
  • feComponentTransfer
  • feComposite
  • feConvolveMatrix
  • feDiffuseLighting
  • feDisplacementMap
  • feFlood
  • feGaussianBlur
  • feImage
  • feMerge
  • feMorphology
  • feOffset
  • feSpecularLighting
  • feTile
  • feTurbulence
  • feDistantLight
  • fePointLight
  • feSpotLight

In Listing 14, a shadow effect is created that jumps out, congealing to the rectangle.

Listing 14. Creation of the shadow effect for the rectum that flops up.

The code for hovering over listing 14 gives an image, showing baby 14.

Malyunok 14. The effect of shade for the orthocutaneous species that springs up.

Filters are defined in the middle of the def element (short for the English "definition"). The filter in this application is assigned the identifier (id) "f1". The filter tag itself contains attributes indicating the coordinates along the X and Y axes, and the width and height of the filter. In the middle of the filter tag, you select the required filter elements and set the required values ​​for their powers.

After selecting a filter, you associate it with a specific filter attribute, as shown in .

How to set the value of the url to assign the value of the id attribute to the filter.

Gradients Gradient

There is a gradual transition from one color to another. There are two main types of gradients: linear and radial. The type of gradient that is set is determined by the element you selected. At the lower butts, the solidification of linear and radial gradients to an ellipse is shown.

Listing 15 creates an ellipse with a linear gradient.

Listing 15. Creation of an ellipse with a linear gradient

The code for hovering on listing 15 gives an image, showing baby 15.

Malyunok 15. Ellipse with linear gradient

Listing 16 creates an ellipse with a radial gradient.

Listing 16. Creation of an ellipse with a radial gradient

The code for hovering on listing 16 gives an image, showing baby 16.

Malyunok 16. Ellipse with a radial gradient

Gradients, like filters, are defined in the middle of the def element. The skin gradient is given an identifier (id). Gradient attributes (for example, colors) are inserted in the middle of the gradient tag behind the stop element. To freeze any gradient down to the smallest detail, set the url value for the fill attribute identifier (id) of the required gradient.

Text and SVG

In addition to creating basic geometric shapes, SVG can also be customized to create text, as shown in Listing 17.
Listing 17. Creating text for help SVG

I love you SVG

Malyunok 17. Text, creations SVG

In this application, behind the additional text element, the proposition I love SVG is created. When the text element is selected, the text that is actually displayed is located between the opening and closing text elements.

You can display text using different axes and draw paths. In Listing 18, the text is displayed in an arc-like path.

Listing 18. Creating text with an arc-like trajectory
I love SVG I love SVG

The code for hovering on listing 18 gives an image, showing baby 18.

Malyunok 18. Text arranged in an arc-shaped path

In this application, an additional XML namespace xlink is added to the SVG root tag. The trajectory that is used to bend the text with an arc is created in the middle of the element, so the trajectory itself is not visualized. The text that is displayed is placed in the middle of the textPath element, which uses the xlink name space to expand to the id of the desired path.

As with other little things in the SVG format, you can also add filters and gradients to the text. Listing 19 will have a filter and gradient applied to the text.

Listing 19. Creating text with a filter and gradient
I love SVG I love SVG

The code for hovering over listing 19 gives an image, showing baby 19.

Malyunok 19. Text with filter and gradient

Adding SVG XML code to Web pages

Since the XML code of the SVG is created, it can be included in HTML pages in a number of ways. The first method is to directly insert SVG XML code into an HTML document, as shown in Listing 20.

Listing 20. Direct insertion of SVG XML code into an HTML document
Embedded SVG

Of course, this method is the simplest, but it does not allow for repeated errors. Remember that the SVG XML code can be saved in the file extension.svg. If you save small SVG files in a .svg file, you can use the embed, object and iframe elements to include them on the Web page. Listing 21 shows the inclusion code for an SVG XML file with an additional embed element.

Listing 21. Enhancing the SVG XML file with an additional embed element

Listing 22 shows the inclusion code for the SVG XML file behind the additional object element.

Listing 22. Enhancing the SVG XML file with an additional object element

The listing has 23 displays of the inclusion code for the SVG XML file behind the additional iframe element.

Listing 23. Enhancing the SVG XML File with an iframe

If you choose one of these methods, you can include the same small SVG on multiple pages and work on updating the way to edit the output .svg file.

Visnovok

This article looks at the basics of creating little ones in the SVG format. You learned how, using the added geometric elements, you can create basic geometric shapes, such as a line, a rectangle, etc. drawing a line to a point and drawing an arc to a point. In addition, the article shows how to set filters and gradients to small ones in the SVG format, including small ones with text, as well as how to enable SVG graphics on the HTML side.