How to place the Icon at the end of an H4

Asked

Viewed 33 times

0

I’m trying to make a button in React, but unfortunately I can’t put Icon behind the phrase

Quero conseguir por o icon atrás da frase

import React from 'react';
export function BotaoMenu(){
  return(
  <>
  <div className="row-flex-auto ">
    <div className="p-0 mt-0 mb-3">
   
  <a type="button" className="bg-blue-700 hover:bg-blue-800 text-white font-bold py-2 px-4 rounded-full px-12 " href="/">
  <div className="">
  <IconPardao/>
  </div>
  <h4 className="ml-4">  Menu Teste</h4>
  
  </a>
  </div>
    
    </div>
  </>
  );
}

export function IconPardao(){
return(
  <>
  <div >  
  <img className="h-4 w-4" src={teste} />

  </div>

  </>
);

}
export default BotaoPadrao;

1 answer

0


You can solve this easily with CSS using flex.

.container {
  width: 100%;
  display: flex; /* Define que o display dentro do container será flex */
  flex-direction: row; /* Define que os elementos ficarão organizados em linhas */
  align-items: baseline; /* Centraliza o elementos numa linha de base */
  background: lightgray;
}

.container span {
  background: lightyellow;
}

.container h4 {
  background: aqua;
  margin-left: 10px;
}
<div class="container">
  <span>Ícone</span>
  <h4>Isso é um teste</h4>
</div>

  • I liked the idea, but is there something in line? because I’m wearing the tailwind and I don’t even know how to import something to React. I apologize for my lack of practice.

  • Just apply the same idea as inline CSS...

  • Thanks for the help, I will review more about the tailwind patterns as I am very confused on how to use it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.