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

227
Views
How to use CSS to display only three items on a mobile device

If I have a screen that will display 6 items in the computer version, but below the mobile device (414px), only three will be displayed.

Is there a way to achieve this effect through css if the HTML structure is not changed?

.list {
  width: 300px;
}
.list .item {
  width: 100%;
  text-align: center;
  padding: 16px;
  background-color: #fed71a;
}
<ul class="list">
   <li class="item">about1</li>
   <li class="item">about1</li>
   <li class="item">about1</li>
   <li class="item">about1</li>
   <li class="item">about1</li>
   <li class="item">about1</li>
</ul>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here you go.

.list {
  width: 300px;
}

.list .item {
  width: 100%;
  text-align: center;
  padding: 16px;
  background-color: #fed71a;
  list-style: none;
  margin-bottom: 1px;
}

@media (max-width: 414px) {
  .item:nth-child(4),
  .item:nth-child(5),
  .item:nth-child(6) {
    display: none;
  }
}
<ul class="list">
  <li class="item">about1</li>
  <li class="item">about1</li>
  <li class="item">about1</li>
  <li class="item">about1</li>
  <li class="item">about1</li>
  <li class="item">about1</li>
</ul>

about 4 years ago · Juan Pablo Isaza Report
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!