i ran into a bit of a problem and i don’t see how to solve it (either because i’m really dumb, or my googling skills are problematic).
See, i have this contact form that fits perfectly into my webpage.
However, when i don’t fill in any of the blanks, the PHP form is supposed to echo a line “Please fill in the required spaces” inside the form itself.
Problem is, whenever it does that, the whole form expands and the HTML ends up looking broken.
Is there any way i can fit my PHP form into the HTML box without it expanding unnecessarily?
My dimensions for the HTML side has a width of 651, and a height of 351.
Boxes in HTML/CSS will not expand to fit content if you give them explicit dimensions. Their sizes are only dynamic in a particular direction if you don’t specify a size in that direction. A box with a height set to 600px will always have a height of 600px regardless of whether or not the content needs more space than that.
You have a couple of options here. The first and most obvious one is don’t specify an explicit height on the container. If you do that, then the container will size itself vertically to fit its contents.
Your other option is to set overflow behaviour on the box with CSS. You could set overflow:hidden (which will chop off any content that overflows the box and hide it), or overflow:auto (which will add a scroll bar to the box if its content overflows the box). Finally, you can set overflow: scroll, which means the box will always have a scroll bar, whether it needs one or not.