Results 1 to 3 of 3

Thread: CSS <div> tables not taking height attributes

  1. #1
    Join Date
    Aug 2003
    Sydney, Australia

    CSS <div> tables not taking height attributes

    Hi All,

    I have a <div> based table in CSS nested inside another <div> table.

    I can't seem to set the overflow:hidden attribute if there's a line of text in the cell. I know... you're asking "why would you want to?". It would take too long to explain, and it would also take too long to explain why I'm using in-line css. Suffice to say that in the former I want to, and the latter, because the page is generated dynamically, I need to.

    The point is, it doesn't matter how high I set the div, it will revert to the height of the line of text.

    I tried using
    HTML Code:
    <div style='display:table; table-layout:fixed; width:100%'>
      <div style='display:table-row'>
        <div style='display:table-cell; height:2px'>
          Some text
    Of course, that doesn't even have the nested table and it still doesn't work.

    Can anyone tell me where I'm going wrong?

    Oh Lord, please help me be the person my dog thinks I am.

  2. #2
    Join Date
    Mar 2011
    I haven't used CSS tables and I've only browsed the W3C specs, but I suspect you're running into the way cell heights are calculated. I'm not certain, but I don't think you can set a limit directly because tables generally expand vertically to accommodate the content within the width of a cell. See: http://www.w3.org/TR/CSS21/tables.html

    You might be able to add another containing <div> to surround those shown in your example and set it's height and overflow properties. It's difficult to suggest a useful solution when you don't explain why you are using this elaborate mark-up to hold a single <div>/cell that you indicate may or may not have any content.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Aug 2003
    Sydney, Australia
    Thanks. Yes, I'm thinking it might have something to do with cells in tables needing to accommodate whatever is in them.

    As for the elaborate markup, it's because I'm trying to give my old, tired content manager a more flexible design interface.

    In the new design, you can have up to nine rows of elements, and within each row, you can have up to nine columns. Each column is its own table... There need be no correlation between column widths from one row to the next.

    And to deliver one last layer of flexibility, each cell can be divided into three. Designing the page is then a simple process of telling the CMS what data or sets of data you want where.

    I tried using floating divs, but you can't apply a height to an in-line element so that didn't work. And because you can't apply a height, you can't control the verticle alignment of the content (which you can do in a div table. I also considered just allowing the user to place div containers wherever they liked, but decided that wouldn't work with dynamically generated content.

    Thanks again. If you have any more thoughts or suggestions, please let me know

    Oh Lord, please help me be the person my dog thinks I am.

Thread Information

Users Browsing this Thread

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

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.10429 seconds
  • Memory Usage 2,860KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (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_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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 (72):
  • 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
  • bbcode_parse_start
  • postbit_imicons
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • 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