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

153
Visualizações
Putting Text in between 2 Input Boxes React

I am attending to have 2 input boxes next to each other with text in between them. Something like this

[0...    ] < Ranking < [1000...]

However, the most I've been able to get is the two input boxes with no text in between. This is my code so far attending to put the text in between them.

return(
        <div className="two-col">
            <div className="col1">
                <input type={"text"} required={true} placeholder={"0..."} name={"id"}  onChange={update} />
            </div>
            <text> &lt; Ranking &lt; </text>
            <div className="col2">
                <input type={"text"} required={true} placeholder={"1000..."} name={"id"}  onChange={update} />
            </div>
        </div>
    );

And my CSS file


.two-col {
    overflow: hidden;/* Makes this div contain its floats */
}

.two-col .col1,
.two-col .col2 {
    width: 50%;
    background: #f2f2f2;
}

.two-col .col1 {
    float: left;
}

.two-col .col2 {
    float: right;
}

Any help is much appreciated.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

<div className={'container'}>
  <div className={'col'}>
    <input type={'text'} required={true} placeholder={'0...'} name={'id'} onChange={update} />
  </div>
  <div className={'col'}> &lt; Ranking &lt; </div>
  <div className={'col'}>
    <input type={'text'} required={true} placeholder={'...1000'} name={'id'} onChangeonChange={update} />
  </div>
</div>

Using flex

.container {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
}

You can have more control over the row using display: grid (not as well supported as flexbox).

EDIT: graph container

<div className={"container"}>
  <div className={"container inputs"}>
    <div>
      <input
        type={"text"}
        required={true}
        placeholder={"0..."}
        name={"id"}
        onChange={"update"}
      />
    </div>
    <div> &lt; Ranking &lt; </div>
    <div>
      <input
        type={"text"}
        required={true}
        placeholder={"...1000"}
        name={"id"}
        onChange={"update"}
      />
    </div>
  </div>
  <div className={"graphview"}>
    graph view
  </div>
</div>

CSS

.container {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
}

.container.inputs {
  width: 50%;
}

.graphview {
  width: calc(50% - 10px);
  border: 5px solid rgba(0, 0, 0, 1);
}

When using percents and borders, you have to calculate the width.

about 4 years ago · Juan Pablo Isaza Relatório

0

Try to use flexbox

.two-col {
    display: flex;
}

.two-col .col1,
.two-col .col2 {
    background: #f2f2f2;
}

and remove other css

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