如何将元素放在标题部分的右上角?
我很确定这会做您需要的事情。
#header-section1 {
position: relative;
}
#floatright {
position: absolute;
top: 1px;
right: 5px;
}
<div id="header-section">
<div id="header-section1">
<h1><a href="http://esgr2.cspo.qc.ca/">École secondaire<br>Grande-Rivière</a></h1>
<p>Commission scolaire des Portages-de-l'Outaouais</p>
<div id="floatright">
<p><i class="fa fa-envelope" aria-hidden="true"></i> ecole.secondaire.grande-riviere@cspo.qc.ca</p>
<p id="phonenumber"><i class="fa fa-phone" aria-hidden="true"></i> (819)-682-8222</p>
<ul>
<li><i class="fa fa-facebook" aria-hidden="true"></i></li>
</ul>
</div>
</div>
您可能需要调整top
和right
值,并且您可能还需要执行#header-section1
的padding-right
值以防止右盘填充的左置左键内容。
另外,您可能应该使用类代替CSS的ID。强烈建议您使用CSS中的ID。