Skip to content

Instantly share code, notes, and snippets.

@Sampath-Lokuge
Created November 1, 2017 04:34
Show Gist options
  • Save Sampath-Lokuge/96172a1b9b6a447530e99b80abf81cce to your computer and use it in GitHub Desktop.
Save Sampath-Lokuge/96172a1b9b6a447530e99b80abf81cce to your computer and use it in GitHub Desktop.
Photo
@Sampath-Lokuge
Copy link
Author

 .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;
          }
    }

@Sampath-Lokuge
Copy link
Author

Sampath-Lokuge commented Nov 1, 2017

<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