如何在<a> tag (CSS/JS)

时间:2017-07-31 14:19:54

标签: javascript html css

I have this login form which is generated dynamically. When selecting the 'Forgot Password' option, a new 'Back to Login' message appears with a line '|' after it. I need to remove this line but I can't work out how to select it because of where it is displayed.

The parent container has the class .upme-back-to-login inside that is an <a> tag and then after the closing tag </a> there are a set of quote marks which contain the line; see this screenshot of console:

IMG01

内的引号之间设置/删除内容

我的问题是如何使用CSS 或JS 删除或隐藏引号中的内容?

2 个答案:

答案 0 :(得分:0)

你可以这样做

.upme-back-to-login {
  font-size:0;
}
.upme-back-to-login a {
  font-size:16px;
}

那将在父div上将font-size设置为0并隐藏该管道,但它可能会影响链接大小,这也就是我为链接添加font-size的原因

答案 1 :(得分:0)

尝试以下方法:

.upme-back-to-login {
  visibility: hidden;
}
.upme-back-to-login > * {
  visibility: visible;
}

它会使不需要的内容不可见且不可选,就像它根本不存在一样,但不会改变布局中的任何内容(你仍然可以使用嵌套元素的继承字体大小等。)< / p>