Skip to content

Instantly share code, notes, and snippets.

@jamesfacts
Created May 6, 2021 19:18
Show Gist options
  • Save jamesfacts/daebc1a97100d5588b917da5f80bc94a to your computer and use it in GitHub Desktop.
Save jamesfacts/daebc1a97100d5588b917da5f80bc94a to your computer and use it in GitHub Desktop.
Figure with variable aspect ratio
<figure>
<a href="{{ $url }}">
<div class="aspect-ratio-wrap relative" style="padding-bottom: {{ $aspect_ratio ?? '0%' }};">
<img src="{{ $img_url }}" @if($alt) alt="{!! $alt !!}" @endif
class="block absolute top-0 left-0 object-cover w-full h-full">
</div>
</a>
</figure>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment