Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top center an <img> within containing <div> with two L/R float <d

Status
Not open for further replies.

rupertInAust

Programmer
Apr 21, 2006
4
AU
hello all,
does any body have a good reference to ensure a top centered <img> will float above two floated left and right <div>'s when the window resizes smaller? eg;
Code:
+----------+ +----------+  +--------+
|          | | <img>    |  |        |
|          | +----------+  |        |
|          |               |        |
| <div>    |               | <div>  |
|          |               |        |
|          |               |        |
|          |               |        |
+----------+               +--------+

         +---------+
         |         |
         +---------+
+--------+         +-------+
|        |         |       |
|        |         |       |
|        |         |       |
|        |         |       |
|        |         |       |
|        |         |       |
|        |         |       |
+--------+         +-------+


    +---------+
    |         |
    +---------+
+-------+ +-------+
|       | |       |
|       | |       |
|       | |       |
|       | |       |
|       | |       |
|       | |       |
|       | |       |
+-------+ +-------+
The reason is that the image floats under and the div's get control. <img>generally goes under not over. Thanks guys!
 
Set the z-index of the image to something greater than 1. For example:

<img ... style="z-index:9;">

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
AFAIK I know, you cannot control that the way you want. Floated elements will just cascade down according to their order in the code, with non-floated elements being the first to cascade.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top