Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda