小编use*_*463的帖子

如何在 JQuery 中设置文本样式?

我想让文本的一部分变得粗体并且比文本的其他部分更大。但目前我使用的 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('');
});
Run Code Online (Sandbox Code Playgroud)

html css jquery text styling

3
推荐指数
1
解决办法
5571
查看次数

如何让我的时钟用javascript显示6位数?

我有一个时钟显示当前时间小时:分钟:秒.目前时间显示为20:30:25,但我的问题是,当时间是单个数字,例如1.05(3秒)am时,它将在时钟1:5:3上显示如下.我希望它看起来像这样01:05:03.

如何才能做到这一点?

var today = new Date();
var hours = today.getHours();
var minutes = today.getMinutes(); 
var seconds = today.getSeconds();
today = hours+':'+minutes+':'+seconds;
document.write(today);
Run Code Online (Sandbox Code Playgroud)

html javascript css clock

0
推荐指数
1
解决办法
186
查看次数

标签 统计

css ×2

html ×2

clock ×1

javascript ×1

jquery ×1

styling ×1

text ×1