tags:

views:

45

answers:

3

What CSS will produce an element but the browser won't take it into account for laying out anything else? Is such a thing possible?

I want the bird and dog on this page to not affect the centering of the text. http://twitter-meme.appspot.com/

Some solutions that I don't like:

  • Make a single image and set it as background-image. (Then I end up with a big image as a background).
  • Absolutely position the text (Yuck)
+2  A: 

You could use position:absolute on the two images by setting the parent div to position:relative and then positioning the images to left:0 and right:0 respectively.

Gabriel Hurley
does position:relative on the parent hurt anything?
Paul Tarjan
No. So long as you don't actually position the parent (with top, left, bottom or right) then it will behave as normal. position: relative is actually the default behavior but setting it explicitly allows you to absolutely position child elements to the parent instead of to the document window.
Binarytales
@Binarytales : exactly, though you could add left:0, top:0, right:0, or bottom:0 and they'd have no impact.
Gabriel Hurley
A: 

on approach can be z-index.

It will have them floating so you can position them anywhere

Tzury Bar Yochay
+2  A: 

Make the container have position: relative; and then absolutely position the images respective to the container.

reko_t