Created
November 1, 2017 04:34
-
-
Save Sampath-Lokuge/96172a1b9b6a447530e99b80abf81cce to your computer and use it in GitHub Desktop.
Photo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Photo |
Author
Sampath-Lokuge
commented
Nov 1, 2017
.photo {
position: relative;
width: 100%;
height: 200px;
overflow: hidden;
img {
position: absolute;
left: 50%;
top: 50%;
height: 100%;
width: auto;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
img.portrait {
width: 100%;
height: auto;
}
}
<div class="photo">
<img [src]="url" class="portrait">
</div>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment