サイトのトップへ戻る

Twitter 開発者 ドキュメント日本語訳

埋め込み型ウィジットのCSS

ウェブウィジットのTwitterを埋め込む場合には、プレースホルダをあなたのページに貼り付けます。 これは、Twitter の該当するページ (プロフィールやタイムラインやウェブインテント)へのリンクか、ツイートが埋め込まれたHTML <blockquote>のいずれかの形式になります。

These shallow versions of the widgets are progressively enhanced by our widgets.js script to become complex, interactive components. But by being present in your page, we ensure that if the reader of your page is on a bad connection, if Twitter suffers technical difficulties, or if a Tweet you’ve embedded is deleted by its author, the content of your page will always make sense.

By default, embed codes will adopt whatever styling you provide, such as a regular link — Tweet — or a quote:

Want to know how your Tweets are performing? Check out the revamped Tweet activity dashboard: support.twitter.com/articles/20171

— Twitter (@twitter) August 27, 2014


描写されるウィジットに合わせたCSS

以下のコードをあなたのスタイルシートに追加することで、ウィジットのスタイルを例で示した形に似た形式に設定できます。 You can include this code as is, or use it as a starting point to modify to your preferences. The code will style embed codes to look more like these:



Buttons

Links appear styled as buttons.

a.twitter-share-button,
a.twitter-mention-button,
a.twitter-hashtag-button {
  display: inline-block;
  padding: 1px 3px 0 19px;
  border: #ccc solid 1px;
  border-radius: 3px;
  background: #f8f8f8 url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxp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LDEuOTM2LTEuNzcxLDQuMTg0LTEuNzcxLDYuNTgxYzAsNC41NDIsMi4zMTIsOC41NTEsNS44MjQsMTAuODk4DQoJYy0yLjE0Ni0wLjA2OS00LjE2NS0wLjY1Ny01LjkzLTEuNjM4Yy0wLjAwMiwwLjA1NS0wLjAwMiwwLjExLTAuMDAyLDAuMTYyYzAsNi4zNDUsNC41MTMsMTEuNjM4LDEwLjUwNCwxMi44NA0KCWMtMS4xMDEsMC4yOTgtMi4yNTYsMC40NTctMy40NDksMC40NTdjLTAuODQ2LDAtMS42NjctMC4wNzgtMi40NjUtMC4yMzFjMS42NjcsNS4yLDYuNDk5LDguOTg2LDEyLjIzLDkuMDkNCgljLTQuNDgyLDMuNTEyLTEwLjEyOSw1LjYwNi0xNi4yNiw1LjYwNmMtMS4wNTUsMC0yLjA5Ni0wLjA2MS0zLjEyMi0wLjE4NGM1Ljc5NCwzLjcxNywxMi42NzYsNS44ODIsMjAuMDY3LDUuODgyDQoJYzI0LjA4MywwLDM3LjI1MS0xOS45NDksMzcuMjUxLTM3LjI0OWMwLTAuNTY2LTAuMDE0LTEuMTM0LTAuMDM5LTEuNjk0QzY0LjgzOCwyMC4wNjgsNjcuMDU4LDE3Ljc2NSw2OC44MTIsMTUuMTQxeiIvPg0KPC9zdmc+DQo=") 2px 3px no-repeat,
              linear-gradient(#fff, #dedede);
  background-size: 16px 13px, auto auto;

  /* Text */
	font: bold 11px/17px Helvetica, Arial, sans-serif;
  text-decoration: none;
  color: #333;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  white-space: nowrap;
}

/* Color Highlight for keyboard navigation */
a.twitter-share-button:focus,
a.twitter-mention-button:focus,
a.twitter-hashtag-button:focus {
  outline: none;
  border-color: #0089cb;
}


埋め込み型ツイート

Blockquotes have the same dimensions and text size as an embedded Tweet.

blockquote.twitter-tweet {
  display: inline-block;
  padding: 16px;
  margin: 10px 0;
  max-width: 468px;
  border: #ddd 1px solid;
  border-top-color: #eee;
  border-bottom-color: #bbb;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  font: bold 14px/18px Helvetica, Arial, sans-serif;
  color: #000;
}

blockquote.twitter-tweet p {
  font: normal 18px/24px Georgia, "Times New Roman", Palatino, serif;
  margin: 0 5px 10px 0;
}

blockquote.twitter-tweet a[href^="https://twitter.com"] {
  font-weight: normal;
  color: #666;
  font-size: 12px;
}


埋め込み型タイムライン

Timeline links are styled to be distinct, rather than blend into other links on the page.

a.twitter-timeline {
  /* Buttonish */
  display: inline-block;
  padding: 6px 12px 6px 30px;
  margin: 10px 0;
  border: #ccc solid 1px;
  border-radius: 3px;
  background: #f8f8f8 url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgNzIgNzIiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDcyIDcyIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxyZWN0IHg9IjAiIGZpbGw9Im5vbmUiIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIvPg0KPHBhdGggZmlsbD0iIzU1YWNlZSI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+DQo=") 8px 8px no-repeat;

  /* Text */
  font: normal 12px/18px Helvetica, Arial, sans-serif;
  color: #333;
  white-space: nowrap;
}

a.twitter-timeline:hover,
a.twitter-timeline:focus {
  background-color: #dedede;
}

/* Color Highlight for keyboard navigation */

a.twitter-timeline:focus {
  outline: none;
  border-color: #0089cb;
}

これらのスタイル設定は、あなたのサイトで使用するための出発点となります。あなた独自のボタンスタイルが完成させた場合は、それらを ウェブサイト用 Twitter の議論フォーラムで共有してください。