Imitating the ele.me project, there is a problem with the absolute positioning of cartcontrol-wrapper in goods, which can only be relative positioning.

goods sets the location of cartcontrol-wrapper to absolute, which only appears at the bottom and cannot be displayed. Can only be relative positioning, what is the reason for this?
clipboard.pngclipboard.png
html Code

              <div class="content">
                <h2 class="name">{{food.name}}</h2>
                <p class="desc">{{food.description}}

<div class="extra"> <span class="count">{{food.sellCount}}</span> <span>{{food.rating}}%</span> </div> <div class="price"> <span class="now">{{food.price}}</span> <span class="old" v-show="food.oldPrice">{{food.oldPrice}}</span> </div> <div class="cartcontrol-wrapper"> <cartcontrol @add="addFood" :food="food"></cartcontrol> </div> </div>

css Code

          .price
            font-weight: 700
            line-height: 24px
            .now
              maigin-right: 8px
              font-size: 14px
              color: rgb(240,20,20)
            .old
              text-decoration: line-throught
              font-size: 10px
              color: rgb(147,153,159)
          .cartcontrol-wrapper
            /*position:absolute*/
            position:relative
            right: 0
            bottom:12px
Apr.25,2021
The reference for

absolute positioning is the parent element where the nearest postion is not static.
there is a problem because div.content does not set position, and you want to position it absolutely relative to it, then set the position of div.content to relative.

Menu