gpt4 book ai didi

html - 如何在 HTML 页面中放置标签

转载 作者:太空宇宙 更新时间:2023-11-04 14:09:31 24 4
gpt4 key购买 nike

我有一个顶部有菜单栏的网页。

我知道在 HTML 中放置制表符,可以这样做:

<p style="text-indent: 5em;">
The first line of this paragraph will be indented about five characters, similar to a tabbed indent.
</p>

但我的问题是如何在菜单栏中做类似的事情?这是我的代码。

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<html>
<head>
<title></title>

<style>
div.ex
{
width:300px;
padding:10px;
border:5px solid gray;
background: white;
margin-left:auto;
margin-right:auto;
margin-top: 200px;
position: relative;
}
p.x {
color: white;
font:25px arial,sans-serif;
position:relative;
left:20px;
}
.align {
position: absolute;
left: 8em;
}
body
{
background-color: #ebebeb;
top: 55px;
}
#rectangle {
width: 100%;
height: 70px;
background: deepskyblue;
position: fixed;
top: 0;
left: 0;
bottom: 20;
}
input[type=button]
{
background-color: lawngreen;
color: white;
}
#text {
padding-top: 80px;
}
</Style>
</head>
<body>
<div id="rectangle">
<p class="x">Home Page <a href="personal?id=${id}"><input type="button" name="sign up" value="Sign Up"/></a>
<a href="hello">Home</a> </p>
</div>
<h1 id="text">Hello world, this is your home page.</h1>
<div class="ex">
<h1>签订</h1>
<hr>
${errorMessage}
<form action="register" method="post">
<p>
<label>
ID:
<input type="text" name="id" value="${person.id}" class="align"/>
</label>
</p>
<p>
<label>
密码:
<input type="password" name="password" class="align"/>
</label>
</p>
<p>
<label>
确认密码:
<input type="password" name="password" class="align"/>
</label>
</p>
<p>
<label>
姓名:
<input type="text" name="name" value="${person.name}" class="align"/>
</label>
</p>
<p>
<label>
地址:
<input type="text" name="address" value="${person.address}" class="align"/>
</label>
</p>
<p>
<label>
电话:
<input type="text" name="phoneNumber" value="${person.phoneNumber}" class="align"/>
</label>
</p>
<input type="submit" value="注册"/>
</form>
</div>
</body>
</html>

换句话说,我想在“注册”按钮和“主页”超链接之间放置制表符。两者都放在蓝色矩形中。

如果有人能帮助我,我将不胜感激。

最佳答案

看来“制表符”实际上是指水平间距。在这种情况下,在某些元素上设置合适的水平边距,例如

<input type="button" name="sign up" value="Sign Up" style="margin-right: 5em"/>
<a href="hello">Home</a>

(您的代码需要修复。例如,a 元素不得包含 input 元素。但这不会影响间距问题。)

关于html - 如何在 HTML 页面中放置标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20892158/

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