Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
Vue.js + Dynamically resize list based on the number of items

I have created a dropdown with input using li. However, the height of the ul is fixed. I want to set the height of ul to set dynamically based on the number of items displayed so that if there are no items in the list the height is less.

enter image description here

 <div class="filterdropdown">
            <input placeholder="Enter a filter name"/>
            <div><img src="../Images/ICE.FilterChevron.png"  @click="filters.isShow = !filters.isShow" /></div>
        </div>
        <div v-if="filters.isShow">
            <ul>
                <li v-on:click="createNew">Create new Filter</li>
                <li v-for="item in filters.entities" v-on:click="filter.changeFilter(item.id,item.name)">{{ item.name }}<div title="Delete filter">x</div></li>
            </ul>
        </div>

CSS

    ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    border: 1px solid #333;
    height: 85px;
    overflow: hidden;
    overflow-y: scroll;
}
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!