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

197
Views
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 answers
Answer question

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 Report

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 Report

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 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!