答案 0 :(得分:2)
关于您的需求:建议您创建一个带有隐藏网格线的表格:
table {
table-layout: fixed;
width: 100%;
}
td {
width: 33%;
font-weight: bold;
}
<table cellspacing="10">
<tr>
<td>McNair Scholar</td>
<td>Member</td>
<td>Spring 2017-Present</td>
</tr>
<tr>
<td>Code2040 Fellow</td>
<td>Fellow</td>
<td>Summer 2017</td>
</tr>
</table>
答案 1 :(得分:1)
p
元素用于段落。您的示例绝对不是段落,因此您需要使用其他元素来组合它。
有几种方法可以解决您的问题。这些方法之一是:
.grid {
display:grid;
grid-template-columns: 50% 25% 25%;
}
<div class="grid">
<div>McNair Scholar</div><div>Member</div><div>Spring 2017-Present</div>
<div>Code2040 Fellow</div><div>Fellow</div><div>Summer 2017</div>
</div>
答案 2 :(得分:0)
将您的文本夹在<pre></pre>
标记中,并通常包含空格/缩进。
<pre>McNair Scholar Member Spring 2017-Present</pre>
<pre>Code2040 Fellow Fellow Summer 2017</pre>
答案 3 :(得分:0)
尝试<script>
var form = document.getElementById('login-form');
form.onsubmit = function (e) {
e.preventDefault();
var user = form.email.value;
var pass = form.pass.value;
console.log(user);
console.log(pass);
$.ajax({
type: "POST",
url: "http://localhost:5000/auth/login",
data: {
username: user,
password: pass
},
done: function (msg) {
alert(msg);
},
fail: function (msg) {
alert(msg);
},
always: function(msg) {
alert(msg);
}
});
form.reset();
};
</script>
white-space:pre-wrap;
p {
white-space:pre-wrap;
}