【发布时间】:2014-11-25 20:09:07
【问题描述】:
我想让我的文本的一部分变得粗体并且比文本的另一部分更大。但目前我使用的 jquery 文本的大小、字体粗细和颜色都相同。例如,从我下面代码的第一个位开始,我希望出现“硬盘驱动器:辅助存储设备”。我希望硬盘驱动器是粗体字和标题。我希望另一半正常字体重量更小。如何使用我拥有的代码在 jquery 或 css 中设置它的样式?:)
如果您能提供帮助,我们将不胜感激!
这是我的 j 查询:
$('#harddrive').hover(function() {
$('#info').text('Hard drive: Secondary Storage Device');
}, function() {
$('#info').text('');
});
$('#cd').hover(function() {
$('#info').text('CD: External Secondary Storage Device');
}, function() {
$('#info').text('');
});
$('#fan').hover(function() {
$('#info').text('Fan: Used to keep the computer cool');
}, function() {
$('#info').text('');
});
$('#powerblock').hover(function() {
$('#info').text('Power Block: Provides power to the computer');
}, function() {
$('#info').text('');
});
【问题讨论】:
-
使用
.html()而不是.text()并换行,然后使用 css 设置样式? -
谢谢一百万 :) 已经完全看过了!
标签: jquery html css text styling