html - 如何在jsp中将整个文本向下移动?

标签 html css jsp

我在页面顶部制作了一个菜单栏。 但是当我插入主体时,它只是与我的菜单栏矩形重叠。如何将整个正文文本向下移动以避免重叠?

<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;
    }
</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></p>
</div>
<h1>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>

“世界您好,这是您的主页”这句话。已与我制作的蓝色矩形重叠。我想将全身场向下移动。我知道一种方法是放置一堆
,但必须有其他方法来做同样的事情。

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

最佳答案

您必须为此更新您的 CSS。例如,像这样用 60px 填充顶部:

#rectangle {
        width: 100%;
        height: 70px;
        background: deepskyblue;
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 20;
    }

关于html - 如何在jsp中将整个文本向下移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20888771/

相关文章:

java - 如何从外部网页内容目录读取文件

jsp - 服务器上的servlet项目异常

javascript - 输入按钮将显示按钮名称和值分开

html - Firefox:100% 和内部填充?

css - 绝对定位的div 在相对定位的div 内?

css - 在容器 div 中并排 float 2 列

html - 如何使用:before to add <use> for <svg> tags?

html - 使用 Bootstrap 和图像网格将鼠标悬停在背景图像上

javascript - 页面加载时滚动条显示在页眉和页脚上方

java - 不知道如何迭代 forEach ArrayList 对象(购物车)中提供的 "items"