Ionic 6 Full Starter App
IonicThemesBuy NOWLive Preview
  • What is Ionic 6 Full Starter App?
  • About this Ionic template
  • Template versions
  • Set up the development environment
  • Running the Ionic app
  • How to use this template?
  • Ionic Capacitor
  • Ionic Code Structure
  • Ionic Data Integration
  • Theming
  • Ionic Progressive Web App
  • Ionic Navigation
  • Ionic Server Side Rendering (SSR)
  • Ionic Splash Screens and Icons
  • App Shell
    • Image Shell
    • Text Shell
    • Aspect Ratio
  • Ionic Custom Components
    • Checkbox Wrapper
    • Countdown timer
    • Ionic Show/Hide Password
  • Ionic Walkthrough (or tutorial)
  • Categories
  • Ionic Firebase Integration
    • Firebase Authentication
    • Firebase CRUD
    • Firebase Hosting
    • Push Notifications
  • Google Maps & Geolocation
  • Ionic Video Playlist
  • Ionic Multi Language
  • Getting Started
  • Ionic Authentication
  • Ionic Side Menu
  • Ionic Profile
  • Contact Card
  • Social Sharing
  • Ionic Notifications
  • Forms and Validations
  • Filters
  • FAQs
  • Common Errors and Solutions
  • Glossary
  • Upcoming features
  • 🧐Changelog
  • Reviews / Testimonials ⭐️⭐️⭐️⭐️⭐️
Powered by GitBook
On this page
  • What is Aspect Ratio?
  • Aspect Ratio Component

Was this helpful?

  1. App Shell

Aspect Ratio

This is a simple component that ensures a block will maintain the specified aspect ratio.

PreviousText ShellNextIonic Custom Components

Last updated 4 years ago

Was this helpful?

What is Aspect Ratio?

Aspect ratio is a term to describe the proportional relationship between the width and height of an image.

For example, the films at the movie theater, they have an aspect ratio of 16:9. This has nothing to do with the actual quality or size of the image, it just means that the width of the image is almost twice as high as the length.

Aspect ratio normally refers to the proportions of an object’s size in different dimensions.

You can use this to check the dimensions when resizing images.

Aspect Ratio Component

The <app-aspect-ratio> is a simple component available on this template that ensures a block will maintain the specified aspect ratio.

It uses an to adjust the height of the element based on its width (using padding-bottom).

This is a very handy component to prevent content from jumping around while the page is loading.

Note: The <app-aspect-ratio> component must be surrounded by a container element with a defined width, as this component will fill the parent width.

<div style="width:80%; margin: 0px auto;">
  <app-aspect-ratio [ratio]="{w:2, h:1}">
    <span>This container will always have a 2:1 aspect ratio</span>
  </app-aspect-ratio>
</div>

See the to learn how to use and customize the Aspect Ratio. There are lots of examples to help you using this component.

ratio calculator
old CSS technique
live Showcase