2021-06-29

Why do the inline-blocks jump to a new line? Is it to do with previous margins?

div {
  width: calc(100vh/6);
  height: calc(100vh/6);
  background: #fdc57b;
  display: inline-block;
}

body {
  background: #62374e;
}

#a {
  margin-left: calc(14vh);
  margin-top: calc(100vh/7.2);
}

#b {
  margin-left: calc(49vw);
}

#c {
  margin-left: calc(14vh);
  margin-top: calc(161vh/5);
}

#d {
  background: #00FF22;
  margin-left: 79.3vh;
  /*This value*/
}
<div id="a"></div>
<div id="b"></div>
<div id="c"></div>
<div id="d"></div>

I have just started learning CSS and was playing around. On CSS battle challenge 1, part 2: Carrom, I noticed something odd: when I change 'This Value' to 79.3 the <div> moves unexpectedly from 4 squares in quadrants with bottom right closer to right edge
to
enter image description here

Why is this? Why doesn't it move off the right edge of the body: there are no div blocks after that define its position?



from Recent Questions - Stack Overflow https://ift.tt/3juOyg2
https://ift.tt/3y5y4iu

No comments:

Post a Comment