Results 1 to 4 of 4

Thread: [RESOLVED] z_index not working

  1. #1
    Join Date
    Mar 2012

    resolved [RESOLVED] z_index not working


    I have a little problem (again) :

    I have a lot of elements on the page (isometric map), nearly each with it's own z-index.
    It's okay, they all respect their z-index priority (high z-index hide low z-index).

    BUT theses two, a simple image (a black box) and a div with a text.

    The image is always on top of the text, whatever z-index I put in the two.

    The funny thing is theses two respect the z-index of all the others elements in the page. But whatever i do, "a1" is alway on top of "a2".

    Meaning i can have this horrible thing : A1 on top of A2, on top of A3, on top of A1.

    A1>A2>A3>A1 !

    Who need to divise by 0 !

            <div id="ratsodie">
    <img id="a1" width="90%" height="90%" src="ratsodie/interface/fond_ville.svg" style="position: absolute; z-index: 365; opacity: 08;">
    <div id="a2" style="position:absolute; top: 10px; left: 10px; z-index: 375; opacity: 1; border: 3px solid rgb(0, 0, 0);"> ville 1 .</div>

    Idea, somebody ?

  2. #2
    Join Date
    Mar 2011
    I don't know why these elements aren't rendering properly for you with respect to their z-index, but I would suggest that you make sure that you have set a position (top/bottom,left/right) on a1, and correct the syntax error in the opacity setting (probably should be "0.8") in the inline style on that element. Either one *might* help (although, I doubt it).
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Feb 2008
    NW Washington State
    Keep in mind that you can't just give an element a z-index of and by itself.
    z-indexing only works with elements that have a declared position.... and using a declared position can appear to be somewhat tricky. Hope this helps clear that up:

    Maybe this will help clear up any misunderstanding you have about declared positioning as well as the use of z-indexing:

    The actual display of a positioned element will depend on whether or not it's parent element also has a declared position or not.

    z-indexing ONLY works with elements that have a declared position.

    Using a declared position like absolute tells and browser to take that element out of the natural flow and do something different with it. So you've got the browser parsing in order from top to bottom, then throwing in some elements that are completely out of the flow.... they can be very hard to control, because there are special rules that apply to elements with declared positions.

    The least understood of those rules is what I call the "Parent Rule". Giving an element a declared position like relative or absolute can have huge differences in how that element is actually displayed depending on whether or not the PARENT of that element also has a declared position.

    So a div which is position:absolute for example will display one way if it's parent also has a declared position and it will display in a completely different manner if it's parent does NOT have a declared position... to review:

    If a div's parent container DOES NOT also have a declared position, the child <div> will do 1 of 2 things.
    If position:relative, it will position as desired but space will be left as though that element was still in the natural flow. So you may move the 500 X 100 element down and over, but a 500 X 100 space will be left, as though it was still there.
    If position:absolute, child is positioned relative to browser window and that position does not change even if window contracts or expands.

    So be sure to give a declared position to both the parent and the child <div>.

    Neglecting to follow this rule is the main reason why the use of declared positioning fails.

    And just one more point, almost never is it necessary to use a declared position, and that method certainly should not be used for general page layout.

    But if and when a special situation comes up that you really do need z-indexing... then of course you will also have to use a declared position. Understanding the "Parent Rule" will make working with z-indexing and declared positions much easier and more successful.
    Best wishes,
    Eye for Video

  4. #4
    Join Date
    Mar 2012
    Ooh ! that works ! I was stupid.

    Tank you to you two :-)
    Last edited by Ddurand; 04-15-2012 at 05:57 PM. Reason: spelling

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.15798 seconds
  • Memory Usage 2,871KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates