請你按照上面要求將這段代碼重新修改,左邊為菜單欄,右邊是表格登記<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>异常记录</title> <style> .main { display: flex; flex-direction: row; justify-content: space-between; align-items: center; float: right; } .info { display: flex; align-items: center; } .info span { margin-right: 10px; } </style> </head> <body> <div id="menu"> <ul> <li><a href="/">首页</a></li> <li><a href="/index2">登记数据</a></li> <li><a href="/history">查询数据</a></li> </ul> </div> <div id="main"> <h1>异常记录登记</h1> <form method="post" action="/submit"> <label>确认线别:</label> <input type="text" name="line"><br> <label>确认日期:</label> <input type="date" name="date"><br> <label>异常机种:</label> <input type="text" name="model"><br> <label>异常现象:</label> <textarea name="issue"></textarea><br> <label>生产日期:</label> <input type="date" name="prod_date"><br> <label>生产班别:</label> <input type="text" name="shift"><br> <label>生产线别:</label> <input type="text" name="prod_line"><br> <label>责任人:</label> <input type="text" name="responsible"><br> <input type="submit" value="提交"> </form> </div> <div class="info"> <span>欢迎访问</span> <img src="https://example.com/logo.png" alt="logo"> </div> </body> </html>
时间: 2023-11-16 10:36:56 浏览: 105
以下是左边为菜单栏,右边为表格登记的 HTML 和 CSS 代码示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>异常记录</title>
<style>
body {
margin: 0;
padding: 0;
}
#menu {
width: 20%;
height: 100vh;
background-color: #f5f5f5;
float: left;
}
#menu ul {
list-style: none;
margin: 0;
padding: 0;
}
#menu li {
margin: 10px 0;
text-align: center;
}
#menu li a {
display: block;
padding: 10px;
text-decoration: none;
color: #333;
font-weight: bold;
}
#menu li a:hover {
background-color: #333;
color: #fff;
}
#main {
width: 80%;
margin: 50px auto;
padding: 20px;
background-color: #f5f5f5;
}
form {
display: flex;
flex-direction: column;
}
input[type="text"], input[type="date"], textarea {
margin: 10px 0;
padding: 10px;
border: none;
border-radius: 5px;
box-shadow: 1px 1px 5px rgba(0,0,0,0.1);
}
input[type="submit"] {
margin-top: 20px;
background-color: #333;
color: #fff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #fff;
color: #333;
border: 1px solid #333;
}
.info {
display: flex;
justify-content: flex-end;
align-items: center;
height: 50px;
background-color: #f5f5f5;
}
.info span {
margin-right: 10px;
}
.info img {
height: 30px;
}
</style>
</head>
<body>
<div id="menu">
<ul>
<li><a href="/">首页</a></li>
<li><a href="/index2">登记数据</a></li>
<li><a href="/history">查询数据</a></li>
</ul>
</div>
<div id="main">
<h1>异常记录登记</h1>
<form method="post" action="/submit">
<label>确认线别:</label>
<input type="text" name="line">
<label>确认日期:</label>
<input type="date" name="date">
<label>异常机种:</label>
<input type="text" name="model">
<label>异常现象:</label>
<textarea name="issue"></textarea>
<label>生产日期:</label>
<input type="date" name="prod_date">
<label>生产班别:</label>
<input type="text" name="shift">
<label>生产线别:</label>
<input type="text" name="prod_line">
<label>责任人:</label>
<input type="text" name="responsible">
<input type="submit" value="提交">
</form>
</div>
<div class="info">
<span>欢迎访问</span>
<img src="https://example.com/logo.png" alt="logo">
</div>
</body>
</html>
```
菜单栏部分设置了一个宽度为20%的固定宽度,表格登记部分设置了一个宽度为80%的自适应宽度,两者通过 float 属性实现了左右排列,而且通过设置 display 属性和 flex 布局实现了表单的垂直排列。
阅读全文