-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics
SVG (Scalable Vector Graphics) is an XML-based format used to define vector-based graphics for the web. Unlike raster images (e.g., PNG, JPEG), SVG graphics do not lose quality when scaled or zoomed.
SVG is used to create lines, shapes, text, and images that are scalable, stylable, and scriptable using CSS and JavaScript.
Scales without losing quality (perfect for logos and icons)
Easily styled with CSS
Can be animated with JavaScript or CSS
Smaller file size for simple graphics
<svg width="200" height="100">
<rect width="200" height="100" style="fill:lightblue;" />
</svg>
Element | Description |
---|---|
<svg> |
Container for SVG content |
<rect> |
Draws a rectangle |
<circle> |
Draws a circle |
<ellipse> |
Draws an ellipse |
<line> |
Draws a line |
<polyline> |
Series of connected straight lines |
<polygon> |
Closed shape with multiple sides |
<path> |
Defines complex shapes and curves |
<text> |
Adds text to SVG |
<svg width="300" height="100">
<rect width="300" height="100" style="fill:tomato;" />
</svg>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" fill="green" />
</svg>
<svg height="100" width="200">
<line x1="0" y1="0" x2="200" y2="100" stroke="black" stroke-width="2" />
</svg>
<svg width="300" height="100">
<text x="20" y="50" font-family="Arial" font-size="24" fill="blue">
Hello SVG
</text>
</svg>
<svg width="200" height="200">
<path d="M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80"
stroke="black" fill="transparent"/>
</svg>
Q1. Draw a red rectangle of 200x100 size using SVG.
Q2. Create a green circle with a radius of 40 pixels.
Q3. Add a line from top-left to bottom-right of a 200x100 area.
Q4. Display the text "Welcome to SVG" using the <text>
element.
Q5. Create a blue ellipse with rx=50
and ry=25
.
Q6. Use <polygon>
to create a triangle.
Q7. Style an SVG shape using CSS instead of style
attribute.
Q8. Animate a circle’s radius using CSS or JavaScript.
Q9. Use <path>
to draw a complex wave shape.
Q10. Create a group of SVG shapes using <g>
tag and apply a transformation.
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics