I was attempting to style divs with display: inline-block;
, but there was space between my divs so I changed everything to font-size: 0px;
and it removed the space. Now when I try to write in the divs, it moves the parent around. Is there a way to not use position
to style the divs, but keep them in place when I add a child element with text?
<!DOCTYPE html>
<html>
<head>
<title>Bummer</title>
<style>
html, body {
height: 100%;
margin: 0px;
padding: 0px;
font-size: 0px;
}
#one {
display: inline-block;
height: 50%;
width: 70%;
background-color: red;
}
#ySpan {
display: inline-block;
font-size: 12px;
}
#two {
display: inline-block;
height: 50%;
width: 30%;
background-color: blue;
}
#three {
display: inline-block;
height: 50%;
width: 60%;
background-color: green;
}
</style>
</head>
<body>
<div id="one">
<span id="span">Text</span>
</div>
<div id="two"></div>
<div id="three"></div>
</body>
</html>