Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
CSS put two divs next to each other

I'm using vue.js and I've tried out using float: left; but it won't work. I'm new to vue.js but it should work using normal css under the style right.

My code:

<template>
    <div class = "bar">
        <h1 class = "subtitle">Mean {{ field || 'No field yet' }}</h1>
        <div class = "meandata">
            <p>{{ mean.data }}</p>
        </div>
    </div>
    


</template>

<style>
.bar {
  width: 400px;
  height: 70px;
  margin: 20px;
  padding: 10px;
  border: 5px;
  font-size: 18px;
  background: #FEFAE0 0% 0% no-repeat padding-box;
  border-radius: 25px;
  opacity: 1;
  box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}

.subtitle{
  font: normal normal normal 20px/20px Sitka Subheading;
  letter-spacing: 0px;
  color: #D4A373;
  opacity: 1;
  float: left;
  margin-left: 20px;
  margin-top: 35px;
  margin-right: auto;
}

.meandata{
    float: left;
    text-align: right;
    margin-left: auto;
    margin-right: 20px;
    font: normal normal normal 70px/50px Sylfaen;
    letter-spacing: 0px;
    color: #987554;
    text-transform: uppercase;
    opacity: 1;

}
</style>

Output I got: enter image description here

Output that I want: enter image description here

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Can this help you?

.bar {
  /*Add*/
  display:flex;
  justify-content: start;
  align-items: center;
  /*End Add*/
  width: 400px;
  height: 70px;
  margin: 20px;
  padding: 10px;
  border: 5px;
  font-size: 18px;
  background: #FEFAE0 0% 0% no-repeat padding-box;
  border-radius: 25px;
  opacity: 1;
  box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}

.subtitle{
  font: normal normal normal 20px/20px Sitka Subheading;
  letter-spacing: 0px;
  color: #D4A373;
  opacity: 1;
  float: left;
  margin-left: 20px;
  margin-top: 35px;
  margin-right: auto;
}

.meandata{
    float: left;
    text-align: right;
    margin-left: auto;
    margin-right: 20px;
    font: normal normal normal 70px/50px Sylfaen;
    letter-spacing: 0px;
    color: #987554;
    text-transform: uppercase;
    opacity: 1;

}
    <div class = "bar">
        <h1 class = "subtitle">Mean Humidity</h1>
        <div class = "meandata">
            <p>35%</p>
        </div>
    </div>
    <div class = "bar">
        <h1 class = "subtitle">Mean Temperature</h1>
        <div class = "meandata">
            <p>35*</p>
        </div>
    </div>
    

about 4 years ago · Juan Pablo Isaza Denunciar

0

You might want to put display:flex on your first div. This will put the two child elements next to eachother.

Optionally you can also put justify-content: space-evenly on the first div to evenly space out the elements within the div.

about 4 years ago · Juan Pablo Isaza Denunciar

0

<div class="meandata"> << add
   <h1 class = "subtitle">Mean {{ field || 'No field yet' }}</h1>
</div>
<div class="meandata">
    <p>{{ mean.data }}</p>
</div>

 .meandata{
    ....
    overflow:hidden;  << add
  }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda