 <!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<style type="text/css">
div.one {
border-style: solid;
border-width: 1px;
border-color: #0000ff;
margin-top: 40px;
width: 500px;
margin-left: 400px;
height: 180px
}
div.two {
border-style: solid;
border-width: 1px;
border-color: red;
margin-top: 5px;
width: 500px;
margin-left: 400px;
height: 480px
}
.one .form-line {
display: flex;
justify-content: left;
align-items:flex-start;
}
label {
display: inline-block;
width: 80px;
text-align: right;
}
.fabu {
margin-top: 15px;
margin-left: 20px;
}
#input1 {
width: 400px;
}
.neirong {
margin-top: 5px;
width: 400px;
}
button:last-child {
width: 100px;
height: 50px;
margin-left: 80px;
}
</style>
</head>
<body>
<div class="one">
<form class="form-horizontal">
<div class="form-line">
<label>用户名</label>
<input type="text" class="form-control" id="input1" value="">
</div>
<div class="form-line"><label>留言内容</label>
<textarea class="neirong" rows="5" cols="50"></textarea>
</div>
<div class="form-line"><button type="submit" class="fabu">发布</button>
</div>
</form>
</div>
<div class="two">
<p></p>
</div>
</body>
</html>
ps,dom 中有很多 id 和 class 设置得不好,但我也只能根据你原来的硬改下去了,css 选择器也有很大改善的空间 |