In Tea Cozy Project in the Tea of The Month section there are five images with three images on one row and the other two images on the row below. In the screenshot i have attached to this message you can see that I have highlighted the heading ‘Bedford Bizarre Tea’. I have set the top margin for this heading to 0px and also in the CSS i have set the figure elements to have margins of 0px. Yet despite this as you can see in the attached screenshot
Hi there! Please never share your code as screenshots, it has no sense almost at all.
Share your full HTML and CSS properly (how to do: Format code in posts) or provide your deploy link (GitHub Pages, etc.) if you have it. Thanks
What is wrong with sharing screenshots? I thought it helps to share screenshot so people can understand my issue better by looking at the code. Is it better to format the code like you say because you can then easily copy and paste the code?
Well, thank you, this is a proper way. But now please share your full HTML and CSS, the issue can be in absolutely unpredictable place, far from this chuck of code.
I am surprised that the img element has a default value as it isn’t mentioned in w3schools default values; it only says default value is display: inline-block.
Aligns the baseline of the element with the baseline of its parent. The baseline of some replaced elements, like <textarea>, is not specified by the HTML specification, meaning that their behavior with this keyword may vary between browsers.
I don’t understand how this vertical-align is working. When the img element is set to ‘top’, the element is supposed to align with the tallest element on the line. From what I can see, even when the vertical-align is set to the default of baseline, the img element is still aligned with the tallest element on the line. The only difference that I can see is when set to 'top, the whole section (class=teaimageslinetwo) is slightly shorter in height.
In the first screenshot the vertical align is at the default value of baseline. So the image element is supposed to be aligned with the baseline of the parent. In this case the parent is the figure element. I have given the figure element an orange background so you can see in screenshot.
In the second screenshot the vertical align is set to bottom. So the image is supposed to be aligned with the lowest element on the line. What is the lowest element on the line that it is supposed to be aligning with? Also why is the orange background of the figure element no longer visible? When I set vertical align to top, the page looks exactly the same as when it is set to bottom.
So when vertical align is set to the default baseline, the figure element (orange background) which is the parent element, has a greater height. The section (green background) which is the grandparent of the image element is expanded in height also.
This vertical align property is by far the strangest property I have come across in CSS so far. Doesn’t make a lot of sense what it is supposed to be aligning to.