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>
(note: the target window is 400px*300px, so if you run the snippet it will look different to the images below. You can fix this by minimising and adjusting the viewport size.)
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
to
Why is this? Why doesn't it move off the right edge of the body: there are no div
blocks afterwards that define its position?
Alternatively, why doesn't the inline-block start against the left edge of the viewing window, like the image below?