Just wondering what the best practise is for aligning divs that are within a div. For example the following image:
So I want to align the ‘course finder’ stuff that is all within [the pink] div. This is within the yellow div. Should I have padding on the yellow, outer div or should I just define the outer div’s height and width then position the pink div and any other div absolutely within the yellow area? Or is there another method I should be using?
It partly depends on what the yellow div is for. If you use absolute positioning, any other content inside that div won’t “see” the pink div, so there will be some overlapping. So the first question is—What else (if anything) will the yellow div be used for?
It’s fine if the text only goes underneath. But that latest image suggests that the form nearly fills the top part of the yellow box, in which case you don’t need abs pos or similar. Just give the form some left padding and let it follow the natural document flow.