How to style Twitter widget using my own CSS

2019-05-05 05:05发布

I have my own design for a Twitter feed and I want to style the default feed using my own design. Is there a way to do that?

The issue is that you can't use the CSS selectors because it appears only after the loading the page.

Please check this pic to give you more idea about what I need

https://dl.dropboxusercontent.com/u/35853519/twitter-widget.jpg

Thanks,

标签: html css twitter
3条回答
戒情不戒烟
2楼-- · 2019-05-05 05:39

Well, You can customize Your twitter widget by doing something like this:

Default Code

<a class="twitter-timeline" href="Pagelink" data-widget-id="Page ID">Tweets by @Test</a>

To remove Header footer, Just add data-chrome="nofooter transparent noheader transparent" and it will look something like this:

<a class="twitter-timeline" href="Pagelink" data-widget-id="Page ID" data-chrome="nofooter transparent noheader transparent">Tweets by @Test</a>

For more customization like link color, Borders etc refer to this article. https://dev.twitter.com/docs/embedded-timelines#customization

I hope this helps :)

查看更多
男人必须洒脱
3楼-- · 2019-05-05 05:47

If by twitter widget you mean the embedded timelines, then see the "client side options" section of the docs https://dev.twitter.com/docs/embedded-timelines for options that you can set.

If you want totally customised output using CSS, then you'll need to write your own solution using the API to spit out content that can be styled.

查看更多
女痞
4楼-- · 2019-05-05 05:49

1# Getting a fully customisable timeline like suggested earlier (by using the API), would require that you fetch the timeline as a json file (https://api.twitter.com/1.1/statuses/home_timeline.json) and manually loop them in your display. More details here https://dev.twitter.com/rest/reference/get/statuses/home_timeline

2# This is as close as I could come with your design @shadeed9. Most of the restrictions are here https://dev.twitter.com/overview/terms/display-requirements final_result_tweetdesign

3# This JS snippet will let you add custom CSS styles to the Twitter embed widget: https://github.com/kevinburke/customize-twitter-1.1 by Kevin Burke

If this solves your question, kindly accept it!

查看更多
登录 后发表回答