Jump to content

text follow background image


godoprod

Recommended Posts

You could position the text onto the correct place, using pixels. When the window would move or resized, the text would stay on that position :) But text only cannot be positioned. Only block-level elements, like DIV as you mention.

...<div style="position:absolute; left:100px; top:150px">positioned text</div>
You would change the red coloured of cource to whatever position you want :)
Link to comment
Share on other sites

This wuold not do it you see:I got the HTML script saying:<div id="text">Something</div>And the CSS file saying:#text { position: absolute; top: 84px; left: 775px;}But when I make my browser window smaller, the text stay still, due to the "position: absolute;". I want it to follow the center align....

Link to comment
Share on other sites

Oh, center alignment. Then you should center align it too :) :)You should place this div at the absolute vertical position the background image is on, and inside a full-width element, to be able to just by style center align it.

<body><div id="holder"><div class="text">something</div></div>...</body>
#holder { width:100%; }#text {text-align:center;position: absolute;top: 84px;}

Another possibility to center align a block element like div, is to apply margin:auto; to it. It keeps getting recommended, but it never worked for me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...