Jquery 仅在tr表上显示一行
我有一张这样的桌子: 我想要的是,强制将Jquery 仅在tr表上显示一行,jquery,html,css,Jquery,Html,Css,我有一张这样的桌子: 我想要的是,强制将高度固定,仅当我将其悬停时才改变,我不会像图片上的红方块那样看到 有人能帮忙吗?您可以在悬停时设置tr高度,如下所示: table{ table-layout: fixed;/* by default auto: by using fixed, it forces the layout as your height and width */ } tr:hover{ height: 200px; /* apply needed height*/ }
高度固定,仅当我将其悬停时才改变,我不会像图片上的红方块那样看到
有人能帮忙吗?您可以在悬停时设置tr高度,如下所示:
table{
table-layout: fixed;/* by default auto: by using fixed, it forces the layout as your height and width */
}
tr:hover{
height: 200px; /* apply needed height*/
}
如果要保持
高度
与一行匹配,则需要设置
的宽度,并设置为少数
或
并使用表格布局:固定代码>
下一步是设置tr
:空白:nowrap代码>+溢出:隐藏代码>(最终文本溢出:省略号;
)
然后在tr:悬停
将空白
重置为正常,单元格将展开以匹配内容高度
给我们一把小提琴,然后(我将)添加这些规则。为您的td/tr应用文本溢出。这里我添加了display:block。因为有时没有这些代码是不起作用的
CSS代码:
.youClass{
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width:100px;
}
.youClass:hover{
white-space:normal;
width:100px;
word-wrap: normal;
word-break:break-all;
}
yourText ='yourTextMore';
`text-overflow:ellipsis` => `yourText...` => output(automatically add '...' at the end of the text)
`text-overflow:clip` => `yourTextMor` => output('e' hide automatically)
说明:
.youClass{
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width:100px;
}
.youClass:hover{
white-space:normal;
width:100px;
word-wrap: normal;
word-break:break-all;
}
yourText ='yourTextMore';
`text-overflow:ellipsis` => `yourText...` => output(automatically add '...' at the end of the text)
`text-overflow:clip` => `yourTextMor` => output('e' hide automatically)
诀窍是将高度约束到内部p
元素,并对TR
悬停设置动画(或)切换
CSS:
HTML
单线
资料
单线
资料
多行
多行
多行
资料
单线
资料
给出您的工作代码或将其放在小提琴上。作为您的身高?..@RokoC.Buljan对不起,您想说什么?