<tfoot id='6SYzF'></tfoot>

  • <small id='6SYzF'></small><noframes id='6SYzF'>

    1. <legend id='6SYzF'><style id='6SYzF'><dir id='6SYzF'><q id='6SYzF'></q></dir></style></legend>
        <i id='6SYzF'><tr id='6SYzF'><dt id='6SYzF'><q id='6SYzF'><span id='6SYzF'><b id='6SYzF'><form id='6SYzF'><ins id='6SYzF'></ins><ul id='6SYzF'></ul><sub id='6SYzF'></sub></form><legend id='6SYzF'></legend><bdo id='6SYzF'><pre id='6SYzF'><center id='6SYzF'></center></pre></bdo></b><th id='6SYzF'></th></span></q></dt></tr></i><div id='6SYzF'><tfoot id='6SYzF'></tfoot><dl id='6SYzF'><fieldset id='6SYzF'></fieldset></dl></div>
          <bdo id='6SYzF'></bdo><ul id='6SYzF'></ul>
      1. 有什么方法可以阻止 CSS :hover text-decoration underline on child?

        时间:2023-11-29

            <bdo id='TnYIJ'></bdo><ul id='TnYIJ'></ul>
            <tfoot id='TnYIJ'></tfoot>
            1. <i id='TnYIJ'><tr id='TnYIJ'><dt id='TnYIJ'><q id='TnYIJ'><span id='TnYIJ'><b id='TnYIJ'><form id='TnYIJ'><ins id='TnYIJ'></ins><ul id='TnYIJ'></ul><sub id='TnYIJ'></sub></form><legend id='TnYIJ'></legend><bdo id='TnYIJ'><pre id='TnYIJ'><center id='TnYIJ'></center></pre></bdo></b><th id='TnYIJ'></th></span></q></dt></tr></i><div id='TnYIJ'><tfoot id='TnYIJ'></tfoot><dl id='TnYIJ'><fieldset id='TnYIJ'></fieldset></dl></div>
            2. <small id='TnYIJ'></small><noframes id='TnYIJ'>

                <tbody id='TnYIJ'></tbody>
                <legend id='TnYIJ'><style id='TnYIJ'><dir id='TnYIJ'><q id='TnYIJ'></q></dir></style></legend>

                  本文介绍了有什么方法可以阻止 CSS :hover text-decoration underline on child?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可能重复:
                  如何获得这个 CSS 文本装饰问题上班吗?

                  我正在使用 jquery 切换效果来显示或隐藏有关列表元素的更多信息:

                  I'm using the jquery toggle effect to show or hide more information about list elements:

                  jQuery(document).ready(function($) {
                      $("ul p").hide();
                      $("ul li").addClass("link");
                      $("ul li").click(function () {
                      $("p", this).toggle(300);
                      });
                  });
                  

                  适用于以下结构:

                  <ul>
                  <li>List element 1<p>Additional info 1</p></li>
                  <li>List element 2<p>Additional info 2</p></li>
                  </ul>
                  

                  为了让它看起来可点击",我正在使用 css 设置 .link 样式:

                  In order to make it look 'clickable' I'm styling .link with css:

                  ul li.link {
                      color: #0066AA;
                  }
                  
                  ul li.link:hover {
                      text-decoration: underline;
                      cursor: pointer;
                  }
                  

                  但我不希望显示的文本看起来像一个链接:

                  But I don't want the text that's revealed to look like a link so:

                  ul li.link p{
                      color: black;
                      text-decoration: none;
                  }
                  
                  ul li.link p:hover {
                      cursor: text;
                      text-decoration: none;
                  }
                  

                  但是 <p> 在悬停时仍然带有下划线(蓝色),尽管抛出了 text-decoration:none;在每一个自由空间!据我了解,这是因为子样式应用在父样式之上,所以我实际上正在尝试将无"放在下划线之上并使其消失.

                  But the <p> is still underlined (in blue) on hover, despite throwing text-decoration:none; in every free space! From what I understand this is because the child styles are applied on top of the parent so what I'm effectively doing is trying to put 'nothing' on top of an underline and have it disappear.

                  所以我的问题(最终!)是这样的:有没有什么办法可以去掉那个下划线而不把 <p><li>(出于其他原因我不想这样做)?

                  So my question (eventually!) is this: Is there any way to get rid of that underline without taking the <p> out of the <li> (which I don't want to do for other reasons)?

                  推荐答案

                  你能控制标记吗?我将 <li/> 内的文本包装在 <span/> 中,并编写 CSS 以仅使用 text 定位范围-装饰:下划线;.

                  Can you control the markup? I'd wrap the text inside the <li/> in a <span/> and write the CSS to target just the span with text-decoration:underline;.

                  实际上,可点击区域应该是一个带有#"href 的 <a/> 元素.将点击处理程序绑定到锚点而不是 li.然后你有更多的伪选择器,比如 a:visited 可以使用,并且点击它的行为会被记录下来.我不确定 p:hover 是否真的应该在 CSS 中工作.我知道可以使用 jQuery 绑定到任何元素,但使用 CSS 我会坚持使用锚元素.

                  Really though the clickable area should be an <a/> element with an href of "#". Bind a click handler to the anchor instead of the li. Then you have more pseudo-selectors like a:visited to work with and the behavior of clicking it is documented. I'm not sure if p:hover is actually supposed to work in CSS. I know it is possible to bind to any element with jQuery, but with CSS I'd stick with an anchor element.

                  这篇关于有什么方法可以阻止 CSS :hover text-decoration underline on child?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:JQuery .slideDown() 向上滑动 下一篇:CSS在悬停时从不同元素更改元素内容

                  相关文章

                • <legend id='tLVjg'><style id='tLVjg'><dir id='tLVjg'><q id='tLVjg'></q></dir></style></legend>
                  • <bdo id='tLVjg'></bdo><ul id='tLVjg'></ul>
                  <tfoot id='tLVjg'></tfoot>

                    <small id='tLVjg'></small><noframes id='tLVjg'>

                    1. <i id='tLVjg'><tr id='tLVjg'><dt id='tLVjg'><q id='tLVjg'><span id='tLVjg'><b id='tLVjg'><form id='tLVjg'><ins id='tLVjg'></ins><ul id='tLVjg'></ul><sub id='tLVjg'></sub></form><legend id='tLVjg'></legend><bdo id='tLVjg'><pre id='tLVjg'><center id='tLVjg'></center></pre></bdo></b><th id='tLVjg'></th></span></q></dt></tr></i><div id='tLVjg'><tfoot id='tLVjg'></tfoot><dl id='tLVjg'><fieldset id='tLVjg'></fieldset></dl></div>