I made a simple project here
‘https://codepen.io/shubham10200/full/YmpaxO’
I have defined the width of the class ‘hor-tab-logo’ to 199px and height 100px.
But when I am inspecting this element the width is different in both divs .
I don’t know where I am going wrong ?
Please help me…
That was odd. In order to have it respect the width of .hot-tab-logo
, I also had to put a width on .description
elements, which is the other element in your flex.
Once I did that, it respected both widths.
If you want the logo div width to be a fixed 199px, then I’d suggest making the description div flex. For me, this worked fine:
.description {
width: 99vw;
}
Take a look here: https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Values_and_units#Numeric_values - specifically, look at ‘relative units’.
may I know why this is happening ? Why it is not working directly by putting width tag?