How to horizontally aligned responsive amp-component?
I'm using https://github.com/ampproject/amphtml/blob/master/extensions/amp-twitter/amp-twitter.md
And facing difficulties to make in center aligned. Can anyone help?
<div class="tweet-box">
<amp-twitter
width="390"
height="330"
layout="responsive"
data-tweetid="585110598171631616">
</amp-twitter>
</div>
If I use layout="responsive" it doesn't add width to output and also doesn't stretch the tweet to full width. If I remove layout="responsive" and give width, lets say 400px then it will give horizontal scrollbar in case of below 400px width.
Same problem is with Facebook embed but Instagram embed works fine
@jitendravyas How are you trying to center-align it now? The current definition uses responsive layout which will resize the twitter embed to fill all of the available width. If this is not what you want - you can provide more styling via CSS or sizes attribute. The centering itself is probably best done using a flexbox CSS.
@dvoytenko That's the problem responsive layout layout="responsive" doesn't resize the twitter embed to fill all of the available width. You can test it here https://ampbyexample.com/components/amp-twitter/
I see. The amp-twitter element itself is sized to available space, but the Twitter implementation is not using all of this space.
@cramforce what do you think if we added display: flex; justify-content: center to the <div id="tweet"> in 3p/twitter.js?
@dvoytenko Is this special to Twitter? Fine by me if it works.
In the current implementation - yes.
@dvoytenko is there a way to override this justify-content: center for amp-twitter you guys added here? I need to left align my twitter embed and I'm not able to figure out how to do it with this 🤔