Add button-hover exercise
This commit is contained in:
parent
a4e4542722
commit
1771e1d86e
|
@ -0,0 +1,12 @@
|
||||||
|
# Button Hover
|
||||||
|
|
||||||
|
Use a transition to increase the font-size property of the button when you hover your mouse over it.
|
||||||
|
|
||||||
|
## Desired Outcome
|
||||||
|
|
||||||
|
![outcome](./desired-outcome.gif)
|
||||||
|
|
||||||
|
### Self Check
|
||||||
|
- Does the font-size property change to increase the size?
|
||||||
|
- Do other properties of the button remain unchanged?
|
||||||
|
- Does the `:hover` pseudo-class trigger the transition?
|
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Button Hover</title>
|
||||||
|
<link rel="stylesheet" href="style.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="transition-container">
|
||||||
|
<button>Transition!</button>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,36 @@
|
||||||
|
#transition-container {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 158px;
|
||||||
|
height: 55px;
|
||||||
|
border: 1px solid black;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: white;
|
||||||
|
color: black;
|
||||||
|
font-size: small;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SOLUTION */
|
||||||
|
|
||||||
|
/* disclaimer: duplicating the `button` element here isn't best practice.
|
||||||
|
In your solution you probably put it right inside the existing `button`,
|
||||||
|
which _is_ the best practice.
|
||||||
|
We separated it out here to make it extra clear what has changed. */
|
||||||
|
|
||||||
|
button {
|
||||||
|
transition: font-size 1s ease-out 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
font-size: x-large;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Button Hover</title>
|
||||||
|
<link rel="stylesheet" href="solution.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="transition-container">
|
||||||
|
<button>Transition!</button>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,20 @@
|
||||||
|
#transition-container {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 158px;
|
||||||
|
height: 55px;
|
||||||
|
border: 1px solid black;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: white;
|
||||||
|
color: black;
|
||||||
|
font-size: small;
|
||||||
|
text-align: center;
|
||||||
|
}
|
Loading…
Reference in New Issue