gpt4 book ai didi

css - "Text-align: center;"让我的右键离开页面

转载 作者:太空宇宙 更新时间:2023-11-04 16:20:33 27 4
gpt4 key购买 nike

我一直在谷歌上疯狂地搜索我的问题,但我似乎无法解决问题。

我已经创建了 iFrame,它使用左右方向按钮滚动浏览 8 个图像。当我 text-align: center; 保存图像的 DIV 时,右箭头 (#leaf2) 消失了。

这是我的 HTML,

<html>
<body>

<div id="leaf1"><button onClick="image_onclick('prev');"><img src="images/leaf.gif/></button</div>
<div id="image_box"></div>
<div id="leaf2"><button onClick="image_onclick('next');"><img src="images/leaf2.gif"/></button></div>

</body>
</html>

这是我的 CSS,

body, p, image{
margin: 0;
padding: 0;
}

button{
background-color: #ffffff;
border: 0;
}

#image_box{
text-align: center;
}

#image_box img{
border: 1px solid black;
}

#leaf1{
position: absolute;
margin: 155px 0 0 8px;
}

#leaf2{
position: absolute;
margin: 160px 0 0 850px;
}

最佳答案

我不确定这是否是复制时的错误,但你有 而不是

此外,如果您试图将图像放在 image_box 的中心,您需要将左右边距设置为自动。所以:

            image_box img{
margin: 0 auto; /* or margin-left:auto; margin-right:auto; */
border: 1px solid black;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com