html - two conditions in one with css possible? -


Hello I have a question according to CSS.

I have 3 links in my navigationbar. I use it:

  # p1 {font-family: ariel, helvicika, sense-serif; Font size: 13px; Line-height: 45px; Font-weight: boulder; Color: # 999999; Text-decoration: None; }   

for the status of which the user is located on which site is located.

If the user rolls over the other two links, then I have this:

  # p2 {font-family: ariel, helvicika, non-serif; Font size: 13px; Line-height: 45px; Font-weight: boulder; Color: # ECECE; Text-decoration: None; } # P2: Hover {font-weight: boulder; Color: # 999999; Cursor: default; } # P2: active {font-weight: lighter; Color: # 999999; }   

The problem is that I want to change the color from P1 when the user has P2 as something like:

  # p2: hover {Font-weight: bolder; Color: # 999999; Cursor: default; # P1 {color: # f23; }}   

Is this possible?

Thank you very much.

html:

  & lt; Div id = "nav" & gt; & Lt; Div id = "link" & gt; & Lt; P1 & gt; Link1 & lt; / P1> & Lt; / Div & gt; & Lt; Div id = "link" & gt; & Lt; P2 & gt; Link2 & lt; / P2 & gt; & Lt; / Div & gt; & Lt; Div id = "link" & gt; & Lt; P2 & gt; Link3 & lt; / P2 & gt; & Lt; / Div & gt; & Lt; Div id = "link" & gt; & Lt; Div id = "login" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;    

This can not be done with pure CSS.

What you can do to use Javascript & amp; # P1 Change the color of #P1 on the hover event.

Or you can use to set the color of # p1 in a variable & amp; Change the value of that variable in # P2: Hover, although I have not tried this method but then there is no css pure CSS, it also uses javascript.

With Javascript (using the jquery library), your code will be:

  $ ("# p2"). Hover (function () {$ ("# p1"). CSS ('color', '# F23');});    

Comments