By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,394 Members | 1,912 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,394 IT Pros & Developers. It's quick & easy.

css text layer, centered, but same 'height' -> how can it be done?

P: n/a
i have a page that shows a random picture, centered.
how do i create a layer that stays centered, but always 300 px down
from the top?

to make it clear again: i want to place a text layer, x=centered,
y=300.

is it even possible, or do layers have get absolute positions?

Jan 27 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Tobi Hammert schrieb:
i have a page that shows a random picture, centered.
how do i create a layer that stays centered, but always 300 px down
from the top?

to make it clear again: i want to place a text layer, x=centered,
y=300.
margin: 300px auto 0 auto;
width: 45em; /* e.g. */

What about the 'same height' from the subject?
--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
Jan 27 '07 #2

P: n/a
hm... this does not work.
the text layer should be placed on top of the picture...
now its just adding the 300px and putting the text under the picture.
but i want the text to cover the pic.

On 27 Jan., 11:14, Johannes Koch <k...@w3development.dewrote:
Tobi Hammert schrieb:
i have a page that shows a random picture, centered.
how do i create a layer that stays centered, but always 300 px down
from the top?
to make it clear again: i want to place a text layer, x=centered,
y=300.margin: 300px auto 0 auto;
width: 45em; /* e.g. */

What about the 'same height' from the subject?
--
Johannes Koch
Spem in alium nunquam habui praeter in te, Deus Israel.
(Thomas Tallis, 40-part motet)
Jan 27 '07 #3

P: n/a
On 2007-01-27, Tobi Hammert <sp*******@gmail.comwrote:
hm... this does not work.
the text layer should be placed on top of the picture...
The problem is we don't know what the rest of your document looks like.
It would work in many circumstances. Post a link to your page.
now its just adding the 300px and putting the text under the picture.
but i want the text to cover the pic.
This is a similar suggestion:

div.text_layer
{
position: absolute;
width: 10em;
margin: 0 auto;
top: 300px;
left: 0;
right: 0;
}

....

<div class="text_layer">text</div>

That will probably put the text layer on top if the image is
normal-flow. But it all depends on the rest of the document which we
can't see!
Jan 27 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.