/    Sign up×
Community /Pin to ProfileBookmark

Can Someone Explain What’s wrong here with the scale up h2

while I was trying to applicate the transform scale, this error is showing, the both h2 has the same properties but one work and the other one don’t.
<!DOCTYPE html>
<html>
<head>
<title>Css3 | 2D Transform Scale</title>
<style>
@import url(‘https://fonts.googleapis.com/css?family=Open+Sans|Poppins‘);
* {
box-sizing: border-box;
}
body {
font-family: ‘Poppins’, sans-serif;
font-size: 18px;
padding: 0;
margin: 0;
text-decoration: none;
height: 100%;
}
.scale {
background-color: #e84118;
border-radius: 5px;
text-align: center;
color: white;
width: 250px;
display: block;
margin: auto;
padding: 10px;
margin-top: 22vh;
font-size: 20px;
}
.up, .down {
background-color: #4cd137;
display: block;
width: 300px;
text-align: center;
margin: 20px;
padding: 5px;
border-radius: 4px;
color: #2a2830;
}
.up:hover + .scale {
transform: scale(2);
}
.down:hover + .scale {
transform: scale(2);
}
</style>
</head>
<body>
<h2 class=”up”>hover to scale up</h2>
<h2 class=”down”>hover to scale down</h2>
<div class=”scale”>
this div will scale
</div>
</body>
</html>

to post a comment
CSSHTML

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumJan 17.2019 — For h2.up the element div.scale is the next but one element, however when using "+" the next element is addressed. Use "~" instead:
.up:hover~.scale {
transform: scale(2);
}
.down:hover+.scale {
transform: scale(0.5);
}
or include .down:
.up:hover+.down+.scale {
transform: scale(2);
}
Copy linkTweet thisAlerts:
@yassine00authorJan 17.2019 — It worked ? Thanks, but what was the problem, is it that we can't use the selector + twice or what?
×

Success!

Help @yassine00 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...