Skip to content
Advertisement

Display Two Div Columns Side By Side In A Row, Such That It Works With AMP (Accelerated Mobile Pages) As Well

I’m trying to display an image (thumbnail) on the left and some text (in a h3 tag) on the right.

Here’s my code:

CSS

JavaScript

PHP

JavaScript

This works absolutely fine normally. But, when I activate the amp plugin (which removes all the elements that are not allowed in AMP), the image starts to display above the text, which breaks the structure.

Can anyone help me figure out a way such that it works without violating the limitations of AMP?

Advertisement

Answer

The actual problem was that I was unaware that you can’t just declare blocks anywhere you want to.. AMP just allows one style block per page. Fixed the issue by putting all the CSS under a single block!

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement