0
我正在建立一個博客,並希望在帖子下做一個評論部分。帖子的維度是相對的(帖子是一個段落),我希望我的評論部分(表單)正確。如果我做這樣的事情:如何在尺寸相對的元素下定位表單?
HTML
<div class="post">
<a class="titles">{{ post.title }}</a>
<br>
<p class="Parg">{{ post.text }}</p>
<br>
</div>
<div>
<form>
<input type="text" name="username" placeholder="Nickname" required />
<br>
<br>
<input type="text" name="body" placeholder="Write your comment here" required />
<br>
<br>
<input type="submit" name="register" value="Add comment" />
</form>
</div>
CSS
.title{
text-align: center;
font-family: Fipps;
}
.post{
text-align: center;
}
.Parg{
position: relative;
margin-left: 30%;
height: 20px;
width: 800px;
font-family: Gotham;
}
用來定位合適的形式附近的段落。
你能更準確? –
由於您在發佈和評論部分使用'div',因此默認情況下您的評論div將低於帖子div。目前還不清楚你想達到什麼目的。反正看看這個[Pen](http://codepen.io/anon/pen/EPZNKq)。 – Arkantos