我的页面结构如下:
<body>
<a href="...">
<img src="..." height="160" width="261">
<img src="..." height="160" width="160">
</a>
</body>
提前致谢
在许多方面,你可以实现这一目标。如果你想保持html结构相同,那么你可以定位你的锚标签,然后是50%的水平和垂直间距,并将它推回自己的高度和宽度。
a{
position: absolute;
top: 50%; left: 50%; /* push it to vertically & horizontally */
transform: translate(-50%, -50%); /* push it back of it's own width & height */
}
a {
display: flex;
width:auto;
}