English 中文(简体)
使用:hover 修改另一类杂货?
原标题:Use :hover to modify the css of another class?

在从另一类人中取回一个元素时,是否有办法修改一个等级的标签?

类似:

.item:hover .wrapper { /*some css*/ }

只有包裹不在项目内,而是在其他地方。

我确实不想用javascript来做这种简单的事情,但如果我不得不,我怎么做? 我的失败尝试:

document.getElementsByClassName( item )[0].onmouseover="document.getElementsByClassName( wrapper )[0].style.background="url( some url )";";

每个类别中只有一个要素。 Don t知道他们为什么在制作模板时不使用身份证,但这只是如何,我可以改变。

[Edit]

它是一个菜单。 每个菜单元素都有一个独特的类别。 当你在要素上被搁置时,就等于右边。 就像一个超支一样,当我使用“速成”工具时,我可以看到,整个网站“html”在“子”活跃时会发生变化(仅指子)。 我叫作总结的人有控制下游子背景的 c。 我在两班之间确实看不到任何联系。

最佳回答

目前,除非你想选择儿童或兄弟姐妹(在座其他答复中作了描述),否则不可能在社会保障局这样做。

对于所有其他案件,你需要Javales。 象安吉斯这样的优质和框架能够相对容易地解决这一问题。

[Edit]

有了新的CSS(4)挑选人:has() Guide from CSS4。 Rocks (archived by Wayback organs) and , llssss 能够针对母体元素/阶级,使CSS-Only解决办法在不久的将来可行!

问题回答

You can do it by making the following CSS. you can put here the css you need to affect child class in case of hover on the root

.root:hover    .child {
   
}

Provided .wrapper is inside .item, and provided you re either not in IE 6 or .item is an a tag, the CSS you have should work just fine. Do you have evidence to suggest it isn t?

EDIT:

仅靠特别安全局就能够影响其中未包含的内容。 为了做到这一点,您的表象如下:

<ul class="menu">
    <li class="menuitem">
        <a href="destination">menu text</a>
        <ul class="menu">
            <li class="menuitem">
                <a href="destination">part of pull-out menu</a>
... etc ...

and your CSS like this:

.menu .menu {
    display: none;
}

.menu .menuitem:hover .menu {
    display: block;
    float: left;
    // likely need to set top & left
}




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签