I was taking a course on HTML and CSS when I found an inconsistency that confused me: (Context: https://codepen.io/Hobror/pen/yLQoqMa)
.ex13f-post-attachment {
font-family: Arial;
width: 350px;
display: flex;
border-style: solid;
border-width: 1px;
border-radius: 15px;
border-color: rgb(220, 220, 220);
align-items: center;
overflow: hidden;
}
.ex13f-attachment-preview {
width: 100px;
height: 100px;
background-color: rgb(220, 220, 220);
margin-right: 10px;
}
.ex13f-attachment-info {
flex: 1;
}
<div class="ex13f-post-attachment">
<div class="ex13f-attachment-preview"></div>
<div class="ex13f-attachment-info">
<div class="ex13f-atachment-link">youtube.com</div>
<div class="ex13f-atachment-description">Backend web development - a complete overview 2021) </div>
</div>
</div>
I have the preview portion of what I am trying to make set to 100px, and want a square shaped, rounded corners section as shown in the image link below. When I set flex to 1 under ex13f-attachment-info
I get to see proper width of 100px for the thumbnail portion of the element I am trying to make.
However, when I don't have flex set to one for the ex13f-attachment-info
(which contains the text portion of the attachment) I find that this affects the thumbnail portion, and it is no longer 100px long.
What is the reasoning for this? For context I also have the entire element limited to 350px wide.
I did play around with flex values to try narrow down the cause of this, and it seems to be tied to flex-grow
being set to one that makes the thumbnail width display the way I want it to. I don't understand how the flex-grow property for attachment-info is affecting the width of attachment-preview.