1

I would like for each element to be the same size and align properly, but as you can see, the elements with fewer total weeks are positioned lower by that space.

enter image description here

I can add phantom rows, but I am hoping to make this correction in css. How can I achieve this?

CSS

.miniMonth{
  position: relative;
  left: 0px;
  display: inline-block;
  padding: 30px;
  width: 340px;
  height: 327px;
  cursor: pointer;
  border: solid black 1px;
}
.contents {
  position: fixed;
  top: 50px;
  bottom: 50px;
  left: 0; 
  right: 0;
  overflow: auto;
  background-color: rgb(225, 225, 225);
}

HTML

<div class="contents">
  <div class="miniMonth">/* CALENDAR CONTENT*/</div>  
   ...
  <div class="miniMonth">/* CALENDAR CONTENT*/</div>
</div>
Nate May
  • 3,814
  • 7
  • 33
  • 86

2 Answers2

5

Use vertical-align: top. The default is baseline which is why all of the bottoms of each .miniMonth's content are aligned.

.miniMonth {
  position: relative;
  display: inline-block;
  vertical-align: top;
  padding: 30px;
  width: 340px;
  height: 327px;
  cursor: pointer;
  border: solid black 1px;
  box-sizing: border-box;
}
1

You can use flexbox. Set parent div to display: flex and Child (minimonths) to flex: 1 1 auto; this will align them in same row and will be the same height.

Shishibi
  • 53
  • 10