Absolute positioning within relative div firefox?

It should be 50% of the parent element. What is the parent element set to? If it's not set to anything, therein lies the problem.

For the image you say top: 50%. 50% of what? It should be 50% of the parent element.

What is the parent element set to? If it's not set to anything, therein lies the problem.

Why not do something like this div { position: relative; top: 0; left: 0; } div img { position: relative; top:25%; left:50%; } The relative for the image means 25% from the top of the div and 50% for the left side.

I tried this, but top: 25% doesn't do anything. Left is working but I need top positioning specifically – Ozkan Oct 12 at 16:08 Try giving the div a specific height. I.E.The size of the image + padding/margin should work – Biotox Oct 12 at 16:13.

Try putting it as a background image if you just want the image there. Div { background-image: url('image. Jpg'); background-position: center; background-repeat: no-repeat; margin: 0px auto; position: relative; width: Xpx; height: Xpx; top: 0px; left: 0px; vertical-align: middle; } and for the text use a div inside and position it using margin, padding or whatever.

How about auto margins: div img { margin-top: -10px; /*img with is 20px*/ display: block; position: relative; margin-left: auto; margin-right: auto; } This works for me in firefox 7.

You'll need display: block and position: absolute for this to work, but auto margins are good for centred things. – tom the bear Oct 12 at 16:10 horizontal margin will work. But I need to vertically align the image – Ozkan Oct 12 at 16:15 Perhaps I've misunderstood, but to vertically align the image you can use 'margin-top: 25%;' in addition to the above.

But you'll have to set the number manually - auto doesn't seem to work. – tom the bear Oct 13 at 8:22.

This is a good article on the subject from CSS-Tricks: css-tricks.com/snippets/css/absolute-cen....

Test this: div { position: relative; top: 0px; left: 0px; background: red; width:500px; } div img { margin-top: -10px; //position: absolute; /*get it out*/ display: block; /*Important*/ margin: auto; /*Important*/ top: 50%; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions