- This topic is empty.
-
AuthorPosts
-
October 12, 2016 at 7:04 am #246439
Funkaholik
Participanthi guys
broke my head already while trying to solve the problem 0_0
if strong placed before img (in html) then img hover has no effect on strong opacity(
need helphere is a link https://codepen.io/Funkaholik/pen/WGJOqA
October 12, 2016 at 7:32 am #246440Shikkediel
ParticipantIt has nothing to do with the strong tags (same if you remove them). I think it’s because you’re trying to select a previous sibling which isn’t possible.
October 12, 2016 at 7:33 am #246441Paulie_D
MemberNot quite sure what you are asking but I think you mean that if the
strong
tag is before the image then hovering the image does not affect thestrong
.This is entirely correct behavour. CSS cannot select UP the DOM.
There is no parent selector or previous sibling selector
October 12, 2016 at 7:36 am #246443Paulie_D
MemberHowever, you can fix this but apply the styles when you hover on the wrapper div.
October 12, 2016 at 12:21 pm #246459Funkaholik
Participantthanx guys
it partly helps but in general if i’ll set opacity to 0
and hover onto wrapper then empty space atop the image
will also be effected (by hover) and it’s no good at all
i tried to play with display none but then image starts jumping
and as long as wrapper is flexible i don’t see any solutions too avoid this
but it just can’t be true .. is there any other option to solve this?
maybe code it in javascript? or there will be same problems?October 12, 2016 at 1:45 pm #246460Shikkediel
ParticipantIt should be easy enough with JS but I’m wondering if there’s another approach yet with CSS alone.
Edit – here hovering the top will prevent the image from rotating:
.back-right-bottom:hover .back:hover ~ #back-contact-img { -webkit-transform: none; transform: none; }
Seems to have a glitch on the border (reacts to hovering as well) so I made that an
outline
instead.Was the opacity shifting also an issue?
October 12, 2016 at 2:09 pm #246461Funkaholik
Participantwelll .. whole idea was to show text by hovering an image) (changing text opacity)
and text should be displayed at the top of an image
and shouldn’t be visible or be able to appear by hover itself .. thanx a lot
but again problem is partly solved.October 12, 2016 at 2:14 pm #246462Shikkediel
ParticipantThen adding a similar line should solve it, if I get the intention.
.back-right-bottom:hover .back:hover { opacity: 0.1; }
Earlier demo was edited to reflect this.
October 12, 2016 at 2:41 pm #246463Funkaholik
Participantwheeee .. you got it
http://codepen.io/Funkaholik/pen/JRkJNW?editors=1100
but would it be semanticaly right?thanx again.
October 12, 2016 at 3:06 pm #246464Shikkediel
ParticipantNo problem. :-)
but would it be semanticaly right?
I would think so. Nothing is pulled “out of context”, it just defines a nested hover. Overriding previous style isn’t super clean but it’s perfectly valid.
October 13, 2016 at 6:42 am #246486Shikkediel
ParticipantI only noticed a weird effect with Firefox when using
outline
. It apparently adapts to the size of the rotation. Usingbox-shadow
could be an alternative.October 13, 2016 at 7:28 am #246489Funkaholik
Participanti took off borders anyways
i use them as markersOctober 13, 2016 at 10:05 am #246491Shikkediel
ParticipantAlrighty, no problem then. Looks like that because of specificity, the first style rule can be a bit shorter by the way:
.back:hover ~ #back-contact-img { -webkit-transform: none; transform: none; }
October 13, 2016 at 11:19 am #246496Funkaholik
Participantindeed
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.