我正在使用twitter feed控件,並且正在嘗試使用javascript調整其中一個元素的字體大小。試圖通過javascript設置標題標記的字體大小
這裏是有問題的HTML片段:
<div class="twtr-hd">
<a class="twtr-profile-img-anchor" href="http://twitter.com/pikefindotcom" target="_blank"><img src="http://a0.twimg.com/profile_images/1266884773/stock-market-chart_normal.jpg" class="twtr-profile-img" alt="profile"></a>
<h3>Pikefin</h3>
<h4><a href="http://twitter.com/pikefindotcom" target="_blank">pikefindotcom</a></h4>
</div>
我試圖改變這個標籤的字體大小:
<h3>Pikefin</h3>
下面是正顯示出相應的CSS Firebug的輸出:
#twtr-widget-1 .twtr-doc, #twtr-widget-1 .twtr-hd a, #twtr-widget-1 h3, #twtr-widget-1 h4, #twtr-widget-1 .twtr-popular {
background-color: #333333 !important;
color: #FFFFFF !important;
}
index.php #4 (line 1)
.twtr-widget h3 {
font-size: 11px !important;
font-weight: normal !important;
}
widget.css (line 12)
.twtr-widget-profile h3, .twtr-widget-profile h4 {
margin: 0 0 0 40px !important;
}
widget.css (line 12)
我使用jquery來檢索元素(聲明:jquery noob)這似乎工作正常,但我無法弄清楚設置字體大小的語法。 這就是我認爲的代碼應該是:
var element = $('.twtr-hdr h3');
element.style.fontSize="17px";
但是,這給了我此錯誤消息: 「element.style是不確定的」
所以我不能確定,究竟什麼類型的對象jquery正在返回。任何援助將不勝感激。
一樣的2答案。所以我不能在3分鐘內發佈另一個答案。 :(此作品! – hunter 2011-03-12 20:49:19
那是因爲我有小於125個代表
– 2011-03-12 20:54:03好吧,有人似乎喜歡它)+1 – hunter 2011-03-12 20:56:32