I am styling a page with flexbox. I had a nicely centered image inside a div with a background image.
body {
width: 700px
}
nav {
width: 100%;
height: 50px;
background-color: #ccc
}
.wrapper,
.banner {
display: flex
}
.wrapper {
flex-direction: column
}
.banner {
background-image: url("https://unsplash.it/1000/600/?random");
background-repeat: no-repeat;
background-position: center center;
height: 300px;
}
.banner img {
height: 140px;
width: 140px;
border-radius: 140px;
border: 3px solid #fff;
align-self: center;
margin: auto;
}
<nav>
</nav>
<article class="wrapper">
<section class="banner">
<img id="profile-pic" src="https://unsplash.it/100/100/?random" />
</section>
</article>
See this codepen:
https://codepen.io/efbbrown/pen/PmOpWo
Now I want to add an x button so the user can change the background image if they please. When I add the button div it pushes the centered image out of position.
Added element:
<section class="banner">
<div class="close-button"></div>
<img id="profile-pic" src="https://unsplash.it/100/100/?random"></img>
</section>
See this codepen for full dilemma:
https://codepen.io/efbbrown/pen/PmOpOq
How can I add this x button to the div without changing the positioning of the center image?
Thanks!