Scaling inline SVG with preserveAspectRatio

Developer
Size
1,692 Kb
Views
16,192

How do I make an scaling inline svg with preserveaspectratio?

What is a scaling inline svg with preserveaspectratio? How do you make a scaling inline svg with preserveaspectratio? This script and codes were developed by Taylor Hunt on 29 September 2022, Thursday.

Scaling inline SVG with preserveAspectRatio Previews

Scaling inline SVG with preserveAspectRatio - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Scaling inline SVG with preserveAspectRatio</title> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <figure> <div class="wrapper-a"> <svg viewBox="0 0 400 400" preserveAspectRatio="xMidYMid"> <image xlink:href="http://placehold.it/400x400" x="0" y="0" width="400" height="400" /> </svg> </div> <figcaption>This wrapper <code>&lt;div&gt;</code> is 300 by 200 pixels.</figcaption>
</figure>
<figure> <div class="wrapper-b"> <svg viewBox="0 0 400 400" preserveAspectRatio="xMidYMid"> <image xlink:href="http://placehold.it/400x400" x="0" y="0" width="400" height="400" /> </svg> </div> <figcaption>This wrapper <code>&lt;div&gt;</code> is instead 200 by 300 pixels.</figcaption>
</figure>
</body>
</html>

Scaling inline SVG with preserveAspectRatio - Script Codes CSS Codes

svg { width: 100%; height: 100%;
}
div { background: grey; }
.wrapper-a { height: 300px; width: 200px; }
.wrapper-b { height: 200px; width: 300px; }
figure { float: left; }
figcaption { margin-top: 1em; }
Scaling inline SVG with preserveAspectRatio - Script Codes
Scaling inline SVG with preserveAspectRatio - Script Codes
Home Page Home
Developer Taylor Hunt
Username tigt
Uploaded September 29, 2022
Rating 3
Size 1,692 Kb
Views 16,192
Do you need developer help for Scaling inline SVG with preserveAspectRatio?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Taylor Hunt (tigt) Script Codes
Create amazing art & images with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!