html - Absolute element not placing over relative element -


within header, trying place pending-button-notification on theimages-cart image. reason, pending-button-notification div showing on left side of header div.

does see why isn't placing correctly?

this problematic code:

<div id="pending-order-button">     <a href="pendingorders.html"><img src="images/cart.png" class="header-buttons" alt="car">         <div id="pending-button-notification"></div>     </a> </div> 

header {      width: 100%;      max-width: 100%;      height: 100px;      position: relative;      border-bottom: 1px solid #e5e5e5;  }  #header-wrap {      width: 90%;      height: 100%;      margin: auto 5%;  }  #header-logo {      width: 200px;      height: auto;      position: absolute;      top: 50%;      transform: translatey(-50%);  }  .header-buttons {      width: 30px;      height: auto;      float: right;      margin: 30px 40px 0 50px;      cursor: pointer;  }  .header-buttons:first-child {      margin-right: 0;  }  #pending-order-button {      position: relative;  }  #pending-button-notification {      border-radius: 15px;      background: #09afdf;      height: 25px;      width: 25px;      position: absolute;      color: #fff;      font-size: 1.3rem;      top: 5px;      left: 5px;      text-align: center;  }
<header>    <div id="header-wrap">      <a href="dashboard.html">logo</a>      <img src="images/menu.png" class="header-buttons" alt="pending orders">      <div id="pending-order-button">        <a href="pendingorders.html"><img src="images/cart.png" class="header-buttons" alt="car">          <div id="pending-button-notification"></div>        </a>      </div>    </div>  </header>

it's float:right on .header-buttons causing problem.

i suggest remove , float #pending-order-button div instead , it's content moved right.


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -