gpt4 book ai didi

css 将表单定位在布局表中图像的顶部

转载 作者:行者123 更新时间:2023-11-28 13:32:43 24 4
gpt4 key购买 nike

我试图在图像上放置一个表单,我希望它作为我整个主页的背景。一切正常。唯一的问题是我想放置一些像素让 50 多个像素下降。我也不想将表格放在右边的尽头,但可以说它前面 30 像素。有什么想法吗?

这是我的 html 代码:

<html>

<head>
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="text">

<div class="homepageTable" width:40px; margin-right:auto; margin-left:auto; style="text-align:right" >
<form action="#" method="post">
<input type="text" size="25" name="first_name" placeholder="first name"><br/>
<input type="text" size="25" name="last_name" placeholder="last name"><br/>
<input type="text" size="25" name="email" placeholder="email"><br/>
<input type="text" size="25" name="retype_email" placeholder="retype your email"><br/>
<input type="text" size="25" name="password" placeholder="password"><br/>
<input type="text" size="25" name="retype_password2" placeholder="retype your password"><br/><br/>

<input type="checkbox" name="I_accept_terms" value=" "><br/>

<input type="submit" value="" name="submit" style="background:url('img/login_button_1.jpg') no-repeat; width:300; height:50; border:none;"/>

</form>
</div>

</div>

</body>
</html>

这是我的 CSS 文件:

#text 
{
width: 961px;
height:219px;
position: relative;
background-image: url(../img/back_img_green.jpg);
background-repeat: none;
}

有什么想法吗?谢谢斯特凡诺斯

最佳答案

将图像绝对定位在相对定位的 div 内。然后根据您想要的距左上角的偏移量绝对定位表单,并为表单提供更高的 z-index。或者将图像设置为 div 的背景。

关于css 将表单定位在布局表中图像的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13369623/

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