【问题标题】:i want to achieve the animation so that two text doesn't overlaps我想实现动画,使两个文本不重叠
【发布时间】:2021-12-31 00:15:09
【问题描述】:

https://codepen.io/shoumiksk/pen/bGoVdgE

这是我想要实现的代码笔链接,另外,当输入字段中有一些文本时,我不希望标题向下滑动。现在当我像这样使用有效时,标题动画停止

.inputdiv input:valid + .content .contenttext {}

还有其他方法吗?

忽略输入字段的错位,这是根据我的用户界面

【问题讨论】:

  • 我认为你可以用 JS 做到这一点。当输入字段不为空时,不要移动跨度

标签: html css sass


【解决方案1】:

您可以为此使用伪选择器:placeholder-shown。但是你必须定义一个占位符,在你的情况下是一个空格placeholder=" "

结果:https://codepen.io/yourbraineatsyou/pen/XWeZogq

更多信息:https://css-tricks.com/almanac/selectors/p/placeholder-shown/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-26
    • 1970-01-01
    • 2018-11-12
    • 1970-01-01
    • 1970-01-01
    • 2011-12-04
    • 2012-01-30
    相关资源
    最近更新 更多