<legend id='MnUch'><style id='MnUch'><dir id='MnUch'><q id='MnUch'></q></dir></style></legend>
  • <tfoot id='MnUch'></tfoot>

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

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

      <bdo id='MnUch'></bdo><ul id='MnUch'></ul>

        CSS在悬停时从不同元素更改元素内容

        CSS change an element content on hover from different element(CSS在悬停时从不同元素更改元素内容)
        <tfoot id='tcqTg'></tfoot>
        <legend id='tcqTg'><style id='tcqTg'><dir id='tcqTg'><q id='tcqTg'></q></dir></style></legend>

          <tbody id='tcqTg'></tbody>
            • <bdo id='tcqTg'></bdo><ul id='tcqTg'></ul>
            • <small id='tcqTg'></small><noframes id='tcqTg'>

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

                  本文介绍了CSS在悬停时从不同元素更改元素内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 CSS 中 是否可以在从不同元素悬停时更改元素的内容?例如,我有这个 div A、B、C、D、E、F.当我将鼠标悬停在 B 中时,我想在 A 中显示一些文本.如果我将鼠标悬停在 C 中,则会在 A 中显示不同的文本.其余的也是如此.将鼠标悬停在 B 到 F 中时,所有更改都发生在 A 中.

                  Is it possible in CSS to change an element's content when hovered from a different element? Let's say for example, I have this divs A, B, C, D, E, F. I want to show some text in A when I hover in B. a different text will appear in A if I hover over in C. and the same goes for the rest. All the changes takes place in A when hovered in divs B to F.

                  推荐答案

                  目前仅使用 CSS 是不可能的.您可以调整孩子或即将到来的兄弟姐妹的风格.但是您不能设置先前兄弟元素或父元素的样式.

                  Currently this is not possible with CSS only. You can adjust the styles of children or upcoming siblings. But you can't set the styles of previous siblings or parent elements.

                  所以关于你的情况,你可以这样做:

                  So regarding your case you could do:

                  <div class="a"></div>
                  <div class="b"></div>
                  <div class="c"></div>
                  

                  CSS

                  /* next sibling only */
                  div.a:hover + div.b { /* styles for b when hovering a */ }
                  
                  /* general sibling selector */
                  div.a:hover ~ div.c { /* styles for c when hovering a */ }
                  div.b:hover ~ div.c { /* styles for c when hovering b */ }
                  

                  你不能走另一条路,例如从 ba.

                  You can't go the other way, from b to a for example.

                  演示

                  先试后买

                  这篇关于CSS在悬停时从不同元素更改元素内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  How do I make a TextGeometry multiline? How do I put it inside a square so it wraps like html text does inside a div?(如何制作 TextGeometry 多线?如何将它放在一个正方形内,以便它像 html 文本一样包裹在 div 内?) - IT屋-程序员软件开发技术分享社
                  Scale background image to fit ie8 window(缩放背景图像以适合 ie8 窗口)
                  @fontface in IE7 (IETEster) not working properly(IE7 (IETEster) 中的@fontface 无法正常工作)
                  Safari 5.1 breaks CSS table cell spacing(Safari 5.1 打破 CSS 表格单元格间距)
                  Put in bold part of description in metatag Drupal module(将描述的粗体部分放在元标记 Drupal 模块中)

                      1. <legend id='myRIi'><style id='myRIi'><dir id='myRIi'><q id='myRIi'></q></dir></style></legend>
                          <bdo id='myRIi'></bdo><ul id='myRIi'></ul>

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

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