我需要使“flex container>div4”与“flex container>div2”垂直重叠和/或水平对齐。
需要div2和div4完全居中。
我使用文本对齐到中心div2,但div4是一个图像。

.flex-container {
  display: flex;
  flex-wrap: wrap;
  background-color: blue;
}

.flex-container > div {
  background-color: #ffffff;
  	margin-top: auto;
    margin-right: auto;
  flex-shrink: 0;
  height: 35px;
 min-width: 150px;
 max-width: 150px;
  text-align: left;
  line-height: 50px;
  font-size: 30px;
}
.flex-container > div2 {
background-color: #ffffff;
flex-shrink: 0;
margin-top: auto;
height: 50px;
  width: 250px;
  text-align: center;
  line-height: 50px;
  font-size: 12px;
  }
  .flex-container > div3 {
	margin-top: auto;
    margin-left: auto;
  	width: 150px;
    height: 35px;
 	text-align: center;
  	line-height: 50px;
  	font-size: 15px;
    position: -webkit-sticky;
  position: sticky;
  top: 0;
  align-self: flex-start;
  background-color: white;
  }
  .flex-container > divspacer {
  	background-color: #ffffff;
  	width: 33%;
    height: 35px;
 	margin: 1px;
 	text-align: center;
  	line-height: 50px;
  	font-size: 12px;
    }
    .flex-container > div4 {
    margin-left: auto;
    background-color: #ffffff;
    text-align: center;
    }

<div class="flex-container">

  	<div><img src="https://oakandrocks.com/wp-content/uploads/2019/04/perfootersmol.png"></div>
    <div2>
    <a class="inline" style="text-decoration: none" href="https://oakandrocks.com/onr"> Webmasters |</a>
	<a class="inline" style="text-decoration: none" href="https://oakandrocks.com/terms"> Terms & Conditions |	  </a>
	<a class="inline" style="text-decoration: none" href="https://oakandrocks.com/privacy"> Privacy Policy 		</a>
    </div2>
	<div3><a style="text-decoration: none" href="https://oakandrocks.com/">© 2019 Oak & Rocks</a></div3>
</div>
<div class="flex-container"><div4><img src="https://oakandrocks.com/wp-content/uploads/2019/04/footertxt.png"></div4></div>

所以,总结一下,可能没有重叠,但我需要div4(网站解决方案png)完美地居中和页面底部(可能是1px垂直边距)
固定的:
.flexcontainer > div4 {
display: block;
margin-left: auto;
margin-right: auto;
}

最佳答案

像往常一样,在发布问题之后,我就想出了一个解决办法。
添加:

.flexcontainer > div4 {
display: block;
margin-left: auto;
margin-right: auto;
}

09-25 21:36