denysdovhan
denysdovhan

Reputation: 988

How to layer 2 svg images

I would apreciate if you can guide me in the right direction.

I require to layer two svg images using JS or CSS like the example Image i have below (Phone and a Graphic) so it appears to be as one image.

Thank you

iPhone

Upvotes: 1

Views: 2913

Answers (1)

Jonathan M.
Jonathan M.

Reputation: 387

I create this plunkr for your question: https://plnkr.co/edit/RPAA1JkRM6Or1pY9yMeI

.container-iphone {
    width: 657px;
    height: 588px;
}
.container-iphone img {
	position: absolute;
	z-index: 2;
}
.container-iphone .inside {
  padding-top: 50px;
	text-align: center;
  transform: translate(50%,50%);
  position: relative;
  width: 339px;
}
<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Iphone Mask - Jonathan Muszkat</title>
  <meta name="description" content="Iphone Mask">
  <meta name="author" content="Jonathan Muszkat">
  <link rel="stylesheet" href="style.css">
</head>

<body>
	<div class="container-iphone">
		<img src="http://i.imgur.com/WXt6Pyu.png" />
		<div class="inside">whatever whatever whatever whatever whatever whatever whatever whatever whatever<br/> whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever <div>
	</div>
</body>
</html>

as you can see I modify your iphone image and create a div inside so in that div you could put whatever you want. also SVG.

Thanks, Jonathan

result

Upvotes: 2

Related Questions