If you make the container relative and the content absolute, the content will be able to move freely inside the container. So if you use top: 0; and left: 0; in the content, it will be positioned at the top left corner of the container. This will position the content at the container center from the top left corner of the content. Here is the latest simplest solution — no need to change anything, just add three lines of CSS rules to your container of the div where you wish to center at.
In this case, it will stay on top. Because of that, this is the true vertical center in the column flex-direction. In this case, it will move to bottom. If the demo, I added another child div, to show they are spread out.
Since vertical-align works as expected on a td , you could put a single celled table in the div to align its content. Clunky, but works as far as I can tell. It might not have the drawbacks of the other workarounds. January 2, Html Leave a comment. The links get progressively lower the further right they are in IE. Damn damn damn. If I was to redo the menu a different way is there some way around this? If so how should I try to do it? There is nothing wrong with ie6. And you must be sure that all of the images are at the exact height of your box height, by the way dont forget to declare the box height in your site it is 27px I guess.
The image isn't "there" in terms of layout, it's a background image for the div so doesn't actually intersect anything. However haha! I think I've fixed it by trying a different approach. I've uploaded the new files over the ones I was having trouble with, so if you want to see the old ones please refer back to the attachments in my first post.
Modified it to float left. Set required width and height, relative position from the top of the header div, and applied the line-height suggestion posted above. No box-model issues at all, works fine in both browsers, and the text is where I want it. In the spirit of passing the fixes along, I've attached the corrected files again. Thanks for all the help. Now I can get back to doing the bit I find more enjoyable: the graphic design. What do you think by the way? I know it's hard to tell from one header but thats as far as I've got.
Give me a few mins and i'll upload the other headers. Upload complete, the links now work and link to the different sections well the headers change anyway heh. Much better Looks like you'll have to redo your background graphics? You're perfectly right to point this out - the first rule of web design is forward planning I find. All 5 headers are generated from a single PSD photoshop file. The file has 6 different layer sets.
Set 1 is the overlay graphics which appear on every header - that is the navigation panel, the "megla. The navigation panel is further split down into a semi-transparent white box with a stroke style that does the very slightly transparent black border around it , and some vector lines that are the dividers.
Note, however, that in such cases, the text-align attribute will not align the block-level element itself. It will only align the text within the block. To align block-level elements to the centre, we will need to set its left and right margins to auto using the margin CSS attribute.
This can be done in a variety of ways:. Finally, notice that the text in block-level elements can be separately aligned using text-align too:. Notice that if no explicit text-align property is specified on the block, then it will inherit the most recent text-align property of its parent element s. By default, every HTML element that exists is either an inline or a block.
However, an inline element can easily be changed to become a block-level element and vice versa using the display attribute. There are many more possible values to the display CSS attribute than just block or inline. They are a topic for another post, however.
0コメント