最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Changing The Size of Twitter's Follow Button? - Stack Overflow

matteradmin7PV0评论

I'm looking at the new Twitter Follow Button (), but unfortunately my sidebar is smaller than the default size, thus throwing my whole site out of whack.

Is there an easy way to hack the script to resize the button, or at least to put a line break between the actual follow button and the account name?

I'm looking at the new Twitter Follow Button (https://twitter./about/resources/followbutton), but unfortunately my sidebar is smaller than the default size, thus throwing my whole site out of whack.

Is there an easy way to hack the script to resize the button, or at least to put a line break between the actual follow button and the account name?

Share Improve this question asked Jun 2, 2011 at 13:08 Ferrett SteinmetzFerrett Steinmetz 3324 silver badges12 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

If you look at the page source, then your twitter code converts from

<div class="twitter">
  <!-- twitter code here -->
</div>

to

<div class="twitter">
  <iframe ...>...</iframe>
</div>

Now it's easy to change the width of the button via css:

.twitter iframe {
  width: 80px !important;
}

I'd wrap the button in a container with a nice class name and use CSS to adjust the styling.

.twitter-button-container{
  width: 100px;
  height:100px;
}

Something like that.

UPDATE

On second thought, it seems that the image is a background image to the anchor tag. I don't think it's possible to resize background images using CSS etc. You'd need to have the image in an img tag.

Post a comment

comment list (0)

  1. No comments so far