Hey everyone, I need some help understanding why the flexbox is behaving oddly in this code snippet.
1.
<!DOCTYPE html>
<html>
<head>
<style>
body{
position: relative;
}
.container {
display: flex;
justify-content: space-between;
}
</style>
</head>
<body>
<div class="container">
<div class="item"> hello</div>
<div class="item"> hi</div>
</div>
</body>
</html>
.container {
position: absolute;
left: 0;
top: 0;
display: flex;
justify-content: space-between;
}
.container {
position: absolute;
left: 0;
right:0;
top: 0;
display: flex;
justify-content: space-between;
}
I thought that with justify-content set to space-between, the flexbox would automatically take full width. However, when I adjust the container's position, it no longer takes up the full width and I have to manually force it to do so.