Search code examples
htmlcssreactjsstyling

Why can't I justify-content: space-between or space-evenly on this? I'm confused


I'm trying to evenly space out this one, its basically like a card layout. I'm confused as to why its not spacing despite doing justify-content: space-between or space-evenly. I wanted the "Others" to be evenly spaced.

img

Here is my JSX

 <section className="skills-wrapper">
    <div className="content-wrapper">
        <h1>Tech-Stack</h1>
        <div className="container">
            <div className="title">
                <h2>Web Development</h2>
                <div className="box">
                    <div className="name">
                    </div>
                </div>
            </div>
            <div className="title">
                <h2>Software Development</h2>
                <div className="box">
                    <div className="name">
                     </div>
                </div>
            </div>
            <div className="title">
                <h2>Others</h2>
                <div className="box">
                    <div className="name">
                     </div>
                </div>
            </div>
        </div>
    </div>
</section>

Here is my CSS:

.skills-wrapper{
  width: 100%;
  height: 100vh;
  background: #CCD6F6;
}

.content-wrapper{
  width: 100%;
  max-width: 75.5em;
  padding: 1.875em;
  margin: 0 auto;
}

.content-wrapper h1{
  font-size: 2rem;
  color: #E1065E;
  padding: 0.524em 0;
}

.container{
  background: #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.container .title{
  display: flex;
  width: 100%;
}

I tried retracing back and doing it again but I still couldn't figure it out. Can anyone please help me? I'm lost


Solution

  • Remove the width: 100%; from the .container .title selector.

    .container .title {
        display: flex;
        /* width: 100%; */
    }