I am trying out flex for the first time. I thought this would align perfectly, with even spaces in between, but for some reason the margin-right
acts on the last box.
How can I get them to space evenly with the correct margin-right: 3%
on box one and two, but not three, without overriding margin using: margin-right: 0% !important;
.
I get this:
What am I doing wrong?
/* boxes sit in a page area div */
#pageArea {
width: 96%;
margin: 0px auto;
padding: 0% 0 0% 0;
}
/* flex */
.evenly {
display: flex;
justify-content: space-between;
border: solid;
}
.item {
white-space: nowrap;
background: gray;
width: 33%;
border: 1px solid #DBDBDB;
margin: 0 3% 5% 0;
}
<div class="evenly">
<div class="item" id="item1">Item One</div>
<div class="item" id="item2">Item # Two</div>
<div class="item" id="item3">Item Three</div>
</div>