Best practice way to handle variable content margin?
Posted
by Aithne
on Stack Overflow
See other posts from Stack Overflow
or by Aithne
Published on 2010-04-28T00:27:11Z
Indexed on
2010/04/28
0:33 UTC
Read the original article
Hit count: 289
Ok, so a quick site that I am throwing together for a friend has about 20 static pages. Each one with a small amount of content. the div Container contains, well, the div Content, and the div Content contains, obviously, the content that changes on each page.
Now, depending on the length of the content, I want a different margin at the top. The less content, then the larger the margin. Simply an aesthetic choice. For example, if the content almost fills the static sized container, there is less padding, but a 1 line page of content might be 1/3 of the way down the static container. Centering the content in the div wont do, as that creates too large of a margin.
Whats the best way to handle this? A new class for each content with a different margin? A new Id, so that it is in its own special div positioned or margined differently? Inline css on each page to override the standard css for div Content? A differnt spacer div inside Container before Content on each page? Some sort of scripting along the lines of margin of Content = (ContainerHeight - ContentHeight) / 3?
Whats the acceptable way of doing this? I don't want to get into bad habits.
© Stack Overflow or respective owner