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

238
Views
Is there a way to do this in CSS?

So I'm making an HTML based game. In this game, 5 words are chosen at complete randomness. Everything's fine, the code picks 5 words at random, and displays it on the screen, right?

Well I don't like the way the words end up getting styled, and it pretty much looks like this:

enter image description here

So the goal is to end up making the text look like this.

pretty bad photoshopped goal

So far, I haven't tried anything because I didn't really know what to do, however the only one attempted using was inline-block, and it somewhat helped, but not to the full extent of how I want it. Here is the current source code:

<body>
  <div class="content" id="content">
    <div class="wordBank" id="wordBank">
    </div>
  </div>
  <script src="script.js"></script>
</body>
var wordBank = document.getElementById("wordBank")
// sparing you some of the unneeded stuff, this is just the word array
for (let i = 0; i < 5; i++) {
  wordBank.innerHTML += "<p>" + words[Math.floor(Math.random()*words.length)] + "</p>"
}
    body {
      margin: 0px;
    }
    .content {
      width: 512px;
      height: 512px;
      margin-left: auto;
      margin-right: auto;
      font-family: Arial;
    }
    .wordBank {
      border: 2.5px solid black;
      border-radius: 5px;
      font-size: 24px;
    }

How can I achieve my goal effectively? Any help is appreciated.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try something like this: https://codepen.io/c_sharp_/pen/ZEvjvqg

HTML

<div class="wrapper">
    <span class="item">multiply</span>
    <span class="item even">step</span>
    <span class="item">kiss</span>
    <span class="item even">force</span>
    <span class="item">ago</span>
</div>

CSS

.wrapper {
    display: flex;
    width: 100%;
    justify-content: space-between;
    height: 500px;
}
.even {
    align-self: flex-end;
}

alternatively,

.wrapper {
    display: flex;
    width: 100%;
    justify-content: space-between;
    height: 500px;
}
.wrapper > :nth-of-type(even) {
    align-self: flex-end;
}

The numbers are (obviously) placeholders and fit them as you like.

about 4 years ago · Santiago Trujillo 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!