Home > Article > Web Front-end > What types of graphics does HTML5 support?
Graphics are visual representations used to represent any idea or imagination to enhance the user's overall experience with the website. Graphics help convey complex information to users in a simple and understandable way. Some ways to represent information graphically are through photos, art, diagrams, flow charts, etc.
Graphics in HTML are used to enhance the appearance of a web page or website and make user interaction easy. Graphics in HTML serve different purposes, and we have different techniques for this. We will discuss some of them below.
SVG stands for Scalable Vector Graphics. It's like HTML for graphics. SVG files are always saved with the .svg extension. The
SVG has many built-in features such as gradients, opacity, filters, and more, all of which provide scalable, smooth, and reusable graphics for web pages.
<!DOCTYPE html> <html lang="en"> <head> <title>SVG</title> </head> <body> <h1>Below is an example of an svg used as an image.</h1> <img src="https://www.tutorialspoint.com/images/physics-tutorials_icon.svg" alt="SVG"> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title>SVG</title> <style> body{ background: url("https://www.tutorialspoint.com/images/physics-tutorials_icon.svg") no-repeat; } </style> </head> <body> <p>This is Using SVG as background image</p> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title>Document</title> </head> <body> <svg xmlns="http://www.w3.org/2000/svg" width="375.00078" height="728.17084" viewBox="0 0 375.00078 728.17084" xmlns:xlink="http://www.w3.org/1999/xlink" > <path d="M2.79045,484.29492c-.55273,0-1-.44727-1-1V201.5c0-70.91211,57.69043-128.60254,128.60254-128.60254h217.13771c.55273,0,1,.44727,1,1s-.44727,28-1,28l217.1377-27C60.58439,74.89746,3.79045,131.69141,3.79045,201.5V483.29492c0,.55273-.44727,1-1,1Z" fill="#3f3d56" /> <path d="M348.29044,0c.55273,0,1,.44727,1,1V282.79492c0,70.91211-57.69043,128.60254-128.60254,128.60254H3.55021c-.55273,0-1-.44727-1-1s.44727-1,1-1H220.68792c69.80861,0,126.60255-56.79395,126.60255-126.60254V1c0-.55273,.44727-1,1-1h-.00003Z" fill="#3f3d56"/> </body> </html>
CSS stands for Cascading Style Sheets. It is a language used to describe the presentation of a web page and its components such as color, layout, and font information. CSS files are saved with the .css extension.
Mainly used to modify HTML and SVG elements through CSS attributes. HTML elements have several built-in CSS properties, such as fonts, we have font-size, fontwidth, font-weight. Likewise, for other elements we have other properties. All of these properties, when applied to HTML and SVG elements, produce web pages that are scalable, simple, and easy for users to understand.
<!DOCTYPE html> <html lang="en"> <head> <title>CSS</title> <link rel="stylesheet" href="style.css"> <style> body{ background-image: url("image.jpg"); background-color:aqua; background-repeat: repeat; background-position: 0%; } h1{ color:black; border: 2px solid black; font-size: 50px; } p{ color:black; border:2px solid black; font-size: 50px; } </style> </head> <body> <h1>This is an exmaple of using CSS with HTML.</h1> <p>CSS helps in making the content and images of the webpage looks more simpler and presentable.</p> </body> </html>
The Canvas API is a client-side scripting technology that allows rich creation or modification of raster images. The Canvas API uses a vector-based approach to creating shapes and other graphical effects, and since it doesn't have a DOM (Document Object Model), it can perform faster.
Canvas API is used to create graphics using javascript and
<!DOCTYPE html> <html lang="en"> <head> <title>CANVAS API</title> </head> <body> <h1>This is an example of CANVAS API in HTML</h1>> <canvas id="canvas" width="300" height="150" style="border:2px solid black;"></canvas> <script> var c = document.getElementById("canvas"); var ctx = c.getContext("2d"); ctx.beginPath(); ctx.arc(100,55,45,0,2*Math.PI); ctx.stroke(); </script> </body> </html>
PNG - PNG stands for Portable Network Graphics. It is a static file format used for portable, well-compressed storage and exchange of raster images. PNG files are always saved with the .png extension.
PNG files are colorful, with indexed color, grayscale, and have alpha channel transparency. It can be used with HTML, CSS and SVG. PNG files are primarily designed for the web because of their faster streaming and progressive rendering capabilities. Due to these features, they are highly supported in web browsers, graphic creation tools, and imaging toolkits.
In the above lines, we discussed some ways to use graphics in html, but we are not limited to these methods, html and css provide many other ways to use graphics. Given the flexibility offered by html, it is also possible to use moving graphics through animation, automatically change graphics using carasoul, and work with videos.
In conclusion, data analysis can be a powerful tool for emergency management. It allows organizations to collect and analyze data in real-time, identify trends and respond quickly to disasters. Data analytics can also help predict future events, develop more accurate emergency response plans, and improve overall preparedness. By harnessing the power of data analytics for emergency management, organizations can better protect their communities from disaster-related threats.
The above is the detailed content of What types of graphics does HTML5 support?. For more information, please follow other related articles on the PHP Chinese website!