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

267
Views
How to display the icons and not the text on a mobile view without extra markup?

I am trying to see if there is an efficient way to display only the icons and not the text when viewed in mobile view. I only want to display the icons and not the text like 'Previous' or 'Next'

Her is my HTML:

<router-link v-if="myprevLink" :to="'/' + myprevLink">
      <i class="fas fa-angle-double-left"></i> Previous
</router-link>
    <span class="disabled" v-else
      ><i class="fas fa-angle-double-left"></i> Previous
    </span>

<router-link v-if="mynextLink" :to="'/' + mynextLink">
      Next <i class="fas fa-angle-double-right"></i>
</router-link>
    <span class="disabled" v-else>
      Next <i class="fas fa-angle-double-right"></i>
    </span>

The one way I was thinking was to add a span and put my text in there and then use media queries. Like this:

<router-link v-if="myprevLink" :to="'/' + myprevLink">
      <i class="fas fa-angle-double-left"></i><span class = "activePrevLink"> Previous</span>
</router-link>
    <span class="disabled" v-else
      ><i class="fas fa-angle-double-left"></i><span class = "disabledPrevLink"> Previous</span>
    </span>

<router-link v-if="mynextLink" :to="'/' + mynextLink">
      <span class = "activeNextLink">Next</span><i class="fas fa-angle-double-right"></i>
</router-link>
    <span class="disabled" v-else>
      <span class = "disabledNextLink">Previous</span><i class="fas fa-angle-double-right"></i>
    </span>

But doing this way, I am creating 4 of these span tags . Is there a better way to do is and improve this current HTML?

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

0

You don't need to add span tag you can acheive it using css media queries and visibility property like this.

        @media(max-width:600px) {

            router-link,
            .disabled {
                visibility: hidden;
            }

            i::after,
            i::before {
                visibility: visible;
            }
        }
<router-link v-if="myprevLink" :to="'/' + myprevLink">
      <i class="fas fa-angle-double-left"></i> Previous
</router-link>
    <span class="disabled" v-else
      ><i class="fas fa-angle-double-left"></i> Previous
    </span>

<router-link v-if="mynextLink" :to="'/' + mynextLink">
      Next <i class="fas fa-angle-double-right"></i>
</router-link>
    <span class="disabled" v-else>
      Next <i class="fas fa-angle-double-right"></i>
    </span>

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!