Tell us what’s happening:
I can’t figure out how to keep my figcaption aligned with image during resize. It’s fine when shrinking but, it doesn’t stay in place when viewport is increased. I’ve been searching for quite awhile and wasn’t able to find an answer. The closest thing I found said to do display: relative: but, that didn’t work. I thought it might be a flexbox thing but, I couldn’t find anything about it. It’s not part of project, however, I would like to know how to do it.
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" content="width=device-with, initial-scale=1.0">
<link rel="stylesheets" href="styles.css">
<title id="title">Tribute page to Stephen King</title>
</head>
<body>
<header><h1>Stephen King</h1>
<p>Legend of modern day horror</p>
</header>
<hr>
<main id="main">
<div>
<figure id="img-div">
<img src="https://tse3.mm.bing.net/th?id=OIP.zrgaHwDAggOKQu11-EjHngHaEk&pid=Api" alt="Stephen King with sinister smile"/ id="skimage" class="skpic">
<figcaption id="img-caption">source: www.geekmi.news</figcaption>
</figure>
</div>
<hr>
</main>
</body>
/* file: styles.css */
@media (prefers-reduced-motion: no-preference){* {scroll-behavior:smooth;}}
header {text-align:center;width:100%; font-size:25px;font-family:fantasy,impact;background-color:black;color:red}
hr {height:2px; background-color:red; border-color:red;}
.skpic {display:block; margin-left:auto; margin-right:auto;max-width:100%;height:auto;}
figcaption {}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 OPR/109.0.0.0
Challenge Information:
Tribute Page - Build a Tribute Page