0

I have a left column and a right Column. The right column Div element has a Display Value of Flex, but I am unable to add a margin or space in between its two child Div elements.

I found an answer on stack overflow which advised me to use Justify-content: space-around

But this did not seem to work. I am using the code pen platform to practice on.

body {
  margin: 0 auto;
  width: 100%;
  max-width: 2500px;
  padding: 0;
}

* {
  box-sizing: border-box;
}

header {
  background: blue;
  width: 100%;
  height: 100px;
}

a {
  text-decoration: none;
  text-align: center;
  color: #ffffff;
  font-size: 1.15em;
}

h1 {
  position: absolute;
  top: 15px;
  left: 10px;
  float: left;
  left-margin: 6%;
  margin-top: 10px;
  padding: 3px;
}

ul {
  float: right;
  margin: auto;
  margin-top: 37px;
}

li {
  display: inline-block;
  padding-left: 20px;
  padding-right: 10px;
}

.lastlist {
  padding-right: 30px;
}

.wrapper {
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

.leftcolumn {
  padding: 30px;
  float: left;
  width: 70%;
  background: grey;
  height: 2000px;
  display: grid;
  grid-template-rows: 200px 200px 200px;
  grid-template-columns: 1fr 1fr 1fr;
  grid-gap: 20px;
  border-radius: 1px;
}

.box1 {
  grid-column: 1/3;
}

.rightcolumn {
  padding: 30px;
  float: left;
  width: 30%;
  background: pink;
  height: 2000px;
  border-radius: 1px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.rightbox1 {
  flex: 1 30px;
  margin-left: 2%;
}

.rightbox2 {
  flex: 1 30px;
}

div {
  background: white;
  border-radius: 5px;
  padding: 10px;
}
<header>
  <h1>Daniel Savva</h1>
  <nav>
    <ul>
      <li> <a href="#"> Home</a> </li>
      <li> <a href="#"> Portfolio</a> </li>
      <li> <a href="#"> Gallery</a> </li>
      <li> <a href="#"> Contact</a> </li>
      <li class="lastlist"> <a href="#"> Services</a> </li>
    </ul>
  </nav>
</header>
<div class="wrapper">
  <div class="leftcolumn">
    <div class="box1">hi</div>
    <div>hi</div>
    <div>hi</div>
    <div>hi</div>
    <div>hi</div>

  </div>
  <div class="rightcolumn">
    <div class="rightbox1">hello</div>
    <div class="rightbox2">hello</div>
  </div>
</div>
G-Cyrillus
  • 101,410
  • 14
  • 105
  • 129
Daniel Savva
  • 33
  • 1
  • 7

2 Answers2

1

Please replace "rightcolumn" child css with given css.

.rightbox1 {
    flex: 1 1 auto;
    margin: 5px;
}
.rightbox2 {
    flex: 1 1 auto;
    margin: 5px;
}
Varis
  • 91
  • 1
0

Try this:

.rightbox1 {
    flex: 1 30px;
    margin: 0 2%;
}

.rightbox2 {
    flex: 1 30px;
    margin: 0 2%;
}
NullDev
  • 6,739
  • 4
  • 30
  • 54