如何将元素放在标题部分的右上角

  • 本文关键字:标题部 右上角 元素 html css
  • 更新时间 :
  • 英文 :


如何将元素放在标题部分的右上角?

我很确定这会做您需要的事情。

    #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>

您可能需要调整topright值,并且您可能还需要执行#header-section1padding-right值以防止右盘填充的左置左键内容。

另外,您可能应该使用类代替CSS的ID。强烈建议您使用CSS中的ID。

最新更新