Skip to content Skip to sidebar Skip to footer

Css, Div Alignment Issue

I have two divs that make up my header, #title and #header. They are inside #totalTop. They should be flush against the top, and they should be flush against each other. Here's how

Solution 1:

I think you need vertical-align: top on your display: inline-block elements.

That should sort it out.

If it's not that, try removing all whitespace inside your HTML markup around those elements. (it's a known issue)

I'm not sure because you haven't shown all the relevant code.

Solution 2:

The display:inline-block is causing them to behave like they're in a line of text. Stick this in your #title and #header blocks:

vertical-align: top;

The horizontal problem is most likely caused by a space in between them; you could edit your HTML to make sure that there is no whitespace between the end of the title div and the start of the header div, or you could get rid of that "display:inline-block;" that you don't actually mean anyway. For fixing the old-IE browser bugs, I recommend this hack:

#display:inline-block;

(That is, insert a "#" at the start of the line.)

Newer browsers will ignore that, since it's technically invalid, but it will still work around the old IE bugs.

Solution 3:

just a point of reference for the future when using any Border you can use all of your selection in the same line, for instance

border-bottom: solid #fff 3px;

This will reduce your CSS.

Your problem:

I would user the following and adjust the div's accordingly

#tilte { position: relative; top: 0; wdith:[width of image];}

you could also use absolute but being as the div's are inside another relative will work fine

#header { position:relative; top:0 width:[width of image];}

if #totaltop only contains these two elements then make the widths equal the total width of #totaltop minus border padding margins etc.. this should line them up with alittle bit of

#totaltopdiv {float:left}

hope I have not made any glaring errors it is late and this is my last post today.

Hope this helps.

Post a Comment for "Css, Div Alignment Issue"