Jump to content

Divs and the vertical alignment


Steven

Recommended Posts

http://ngaguild.com/steve/scriptorium/I am working on a little personal project of a site for history students/scholars to gather, share and publish with one another. The reason for this, basically, is to try to learn PHP and SQL. But as with nearly every website I design, I have run into the same problem: divs or text within divs that don't easily veritcal-align themselves in the middle of the parent div. My typical solution is ghetto-cizing my CSS by pushing down top pixels/percentages, but I am wondering if any of you have found an easier and more friendly way??EDIT: I forgot, I did not point out where this is occuring on the page. I have set up a bar div that contains the bar_wrap div which has the designated site width (the bar div is simply there to repeat the bg on the entire page). the wrap harbors two divs: login (for the eventual function of users logging in) and date (a pretty much pointless plot of space to display the day's date). What is happening is that both of these harbored divs are clinging to the top of bar_wrap. Here's the css:
#bar {	height: 38px;	background: url(images/bar_bg.gif) repeat-x; }#bar_wrap { width: 900px; }#login { width: 400px; float: left; }#date { width: 100px; float: right; text-align: right; }

Thanks in advance!

Link to comment
Share on other sites

I think I get it. Those divs are hugging the top because nothing is telling them not to. Try giving the login div and the date div a margin-top value. They will need to be different values to look right. Experiment.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...