0

I need the options 1,2,3,4 to be aligned in a straight line.
options 3 and 4 are centred. it should be aligned with 1 and 2.
how do I change this?

My css code is as below: result-box is the container. results-header is the "Poll results" and the options are in "results". I have used justify-content "stretch" but it doesn't work.

.result-box {
  background-color:#E8E8E8;
}

.results-header {
  color: grey;
  font-size: 20px;
  font-family: 'Gill Sans';
  margin: 0px;
  padding-top: 2px;
}

.results {
  color:#00B2EE;
  align-items: center;
  justify-content: stretch;
  font-size: 20px;
  font-family: 'Gill Sans';
  margin: 0px;
}

enter image description here

grooot
  • 446
  • 2
  • 10
  • 31
  • 3
    Please post a working code example or at least minimal HTML+css required to reproduce the problem. – Dhruvi Makvana Nov 06 '20 at 08:23
  • I would advise with no html given look at this flex-box web page https://yoksel.github.io/flex-cheatsheet/ you have all ins and outs of flex-box and with trial an error you will succeed however I am having a feeling that ```flex-direction:column``` might solve problem but can't say much cause I no html – Ntshembo Hlongwane Nov 06 '20 at 08:27

3 Answers3

0

You need to specify the display: flex propyerty for align-items and justify-content to work :)

0

Use display: flex; with .result class. Here try this one w3schools-css-align

0

Here is an example with the four items correctly aligned to the left.

.results {
  text-align: center;
}

.results-title {
  margin: 0
}

.results-content {
  display: inline-flex;
  flex-direction: column;
  text-align: left;
  padding-left: 0;
}
<div class="results">
  <h3 class="results-title">Poll results:</h1>
  <ol class="results-content">
    <li>Node.js</li>
    <li>Java</li>
    <li>Python</li>
    <li>C#</li>
  </ol>
</div>
Olivier Boissé
  • 15,834
  • 6
  • 38
  • 56