请用html写一个精美的问答页面需要有一个输入框一个开始回答按钮一个回答框
<!DOCTYPE html>
<html>
<head>
<title>问答页面</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f1f1f1;
}
<pre><code> .container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
h1 {
font-size: 36px;
margin-bottom: 20px;
text-align: center;
}
form {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 20px;
}
label {
font-size: 24px;
margin-bottom: 10px;
}
input[type="text"] {
padding: 10px;
font-size: 24px;
border: 2px solid #ccc;
border-radius: 5px;
width: 100%;
max-width: 500px;
margin-bottom: 20px;
box-sizing: border-box;
}
button {
padding: 10px 20px;
font-size: 24px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #3e8e41;
}
#answer {
padding: 20px;
font-size: 24px;
border: 2px solid #ccc;
border-radius: 5px;
width: 100%;
max-width: 500px;
min-height: 200px;
box-sizing: border-box;
}
</style>
</code></pre>
</head>
<body>
<div class="container">
<h1>欢迎来到问答页面</h1>
<form>
<label for="question">请输入您的问题:</label>
<input type="text" id="question" name="question" required>
<button type="submit" onclick="answerQuestion()">开始回答</button>
</form>
<div id="answer"></div>
</div>
<script>
function answerQuestion() {
// 获取输入框中的问题
var question = document.getElementById("question").value;
<pre><code> // 在回答框中显示回答
var answer = document.getElementById("answer");
answer.innerHTML = "您的问题是:" + question;
}
</script>
</code></pre>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/EpF 著作权归作者所有。请勿转载和采集!