Home  >  Q&A  >  body text

javascript - Parent sets relative positioning. Child elements are set to absolute positioning. The child element contains a floating table, and the height cannot be adapted at this time.

1, implement carousel on table, so float is used, and tr in each table is different. The height changes with the table. The parent uses overflow:hidden and is relatively positioned. Please tell me how to achieve high adaptability.

2. How to get the height of the currently displayed table during carousel? ? ?

        .aircontent{
            position: relative;
            width: 980px;
            min-height: 580px;
            overflow: hidden;
        }
        .airlist{
            position: absolute;
            width: 2940px;
        }
        .airlist table{
            float: left;
            width: 980px;
        }
<p  class="aircontent">
    <p  class="airlist" style="left: 0px;">
        <table >
                   
        
仅有的幸福仅有的幸福2662 days ago812

reply all(2)I'll reply

  • 为情所困

    为情所困2017-07-05 10:50:58

    It can be solved with JS.

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-07-05 10:50:58

    .....You have already positioned it absolutely and naturally you cannot get the height.
    The suggestion is still $('.aircontent')css({aircontent:$('.airlist').height() + 'px'}):

    reply
    0
  • Cancelreply