简体   繁体   English

如何使嵌入式Twitter feed在较小的屏幕上响应大小?

[英]How to make embedded Twitter feed responsive in size for smaller screens?

Here is the code generated by Twitter to embed into my web site: 这是Twitter生成的嵌入到我的网站中的代码:

<a class="twitter-timeline" data-width="250" data-height="1000" href="https://twitter.com/Supernova_Style?ref_src=twsrc%5Etfw">Tweets by Supernova_Style</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

I have tried a few different ways in CSS to change the width of the feed but it doesn't work. 我在CSS中尝试了几种不同的方法来更改Feed的宽度,但是它不起作用。 I would like to keep the twitter feed visible as the screen size is shrunk to mobile size. 我希望保持Twitter提要可见,因为屏幕尺寸缩小到了移动尺寸。 Does anyone have any ideas on how I can do that? 有人对我该怎么做有任何想法吗?

We've found lately that Twitter's fairly new code generator for embedded profile timelines at publish.twitter.com still creates the issue of the timeline overflowing the container width for iOS devices, particularly with width and height settings (and no data-tweet-limit set). 我们最近发现,Twitter相当新的代码生成器,用于publish.twitter.com上的嵌入式配置文件时间线,仍然会造成时间线溢出iOS设备的容器宽度的问题,尤其是宽度和高度设置(并且没有数据发送限制组)。

Currently we're handling this issue via added css (with selector potentially preceeded by your additional specificity, as needed): 目前,我们正在通过添加的CSS处理此问题(根据需要,选择器可能会附加您的特殊性):

.twitter-timeline { width: 100vw !important; }

Wrap it in a container and set the attributes to width: 100%; height:auto; 将其包装在容器中,并将属性设置为width: 100%; height:auto; width: 100%; height:auto; then size your container appropriately. 然后适当调整容器的大小。 You can then use media queries where necessary. 然后,您可以在必要时使用媒体查询。

Example: http://jsfiddle.net/o6qrxyga/1/ 示例: http//jsfiddle.net/o6qrxyga/1/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM