Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aligning Divs

Status
Not open for further replies.

audiopro

Programmer
Joined
Apr 1, 2004
Messages
3,165
Location
GB
I have 2 inline divs within a container div.
There is more content in one of the inner divs than the other so are different heights. I would expect the tops to line up but bottoms are aligned. What parameter in the container could set this behaviour?
I am sure that it wouldn't do this if I really wanted it to.

Keith
 
That's the default behavior.

How are you making the divs inline?


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Thanks, I thought the tops always lined up - I'm still learning.

I have display:inline; set in the style sheet.
So how do I line up the tops?



Keith
 
I think I misunderstood (and misspoke). The divs are side-by-side, but aligned at the bottom?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
display: inline in and of itself will not place the divs side by side (at least not in my tests in IE6). What else are you doing to position them?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
The two divs are side by side within a container 675px wide.
I have an 'a' and an 'a:hover' assignment in the stylesheet which sets font properties only.

Code:
.articlesmen{
	width:300px;
	font-size:14px;
	font-family: Verdana, sans-serif;
	text-decoration: none;
	padding:15px;
	margin:5px;
	font-weight:normal;
	font-style:normal;
	text-align: left;
	display:inline;
	color: #000000;
	border-width: 2px;
	border-style: solid;
	border-color: #999999;
	background-image: url("images/canvas.jpg");
}

Keith
 
I'm not sure why you would want to set the div display styles as inline. Since these divs have contents inside, they really should be block level. What I think you need to do is float the divs, or at least one of them. If you did that, they would align at the top.

<.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top