HI

amp-layout

Description

A generic, multi-purpose container element that brings AMP's powerful layouts to any element.

Usage

The amp-layout component allows you to apply aspect-ratio based responsive layouts to any element. The amp-layout component works similarly to the layout attribute on existing AMP components, but supports any HTML markup as children. Other supported layouts all work with amp-layout (e.g., fixed-height, fixed, etc.).

The example below uses amp-layout to create a responsive container around a circle drawn with inline SVG.

<amp-layout layout="responsive" width="1" height="1">
  <svg viewBox="0 0 100 100">
    <circle cx="50%" cy="50%" r="40%" stroke="black" stroke-width="3" />
    Sorry, your browser does not support inline SVG.
  </svg>
</amp-layout>

Attributes

Common attributes

The amp-layout component includes common attributes extended to AMP components.

Validation

See amp-layout rules in the AMP validator specification.

और अधिक मदद की आवश्यकता है?

आपने इस दस्तावेज़ को एक दर्जन बार पढ़ा है लेकिन वास्तव में इसमें आपके सभी प्रश्न शामिल नहीं हैं? शायद अन्य लोगों को भी ऐसा ही लगा हो: स्टैक ओवरफ्लो पर उनसे संपर्क करें।

स्टैक ओवरफ़्लो पर जाएँ
कोई बग मिला या कोई सुविधा गायब है?

The AMP project strongly encourages your participation and contributions! We hope you'll become an ongoing participant in our open source community but we also welcome one-off contributions for the issues you're particularly passionate about.

गिटहब पर जाएं