You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将jQuery Terminal光标设置为下划线样式?

修改jQuery Terminal光标为下划线样式

不用纠结内置变量,直接通过自定义CSS覆盖默认光标样式就能实现下划线效果,试试这段代码:

/* 重置默认光标样式,改为下划线 */
.cmd .cursor {
    border-left: none !important; /* 去掉默认的左侧竖线光标 */
    border-bottom: 2px solid #ffffff; /* 下划线粗细、颜色可按需调整 */
    height: 0.8em; /* 适配字体的高度,避免下划线过高/过低 */
    transform: translateY(2px); /* 微调位置,让下划线和文字对齐 */
}

/* 保留光标闪烁动画(可选) */
.cmd .cursor.blink {
    animation: terminal-blink 1.2s infinite;
}

如果想自定义闪烁动画,也可以替换内置的--animation变量:

:root {
    --animation: underline-blink;
}

@keyframes underline-blink {
    0%, 50% {
        border-bottom-color: #ffffff;
    }
    51%, 100% {
        border-bottom-color: transparent;
    }
}

把这段CSS添加到你的项目样式中,就能得到你想要的下划线光标效果。

内容的提问来源于stack exchange,提问作者NotHim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 03:59:52