Results 1 to 9 of 9

Thread: Can you put a <ul>tag inside a <span> tag????????????????

  1. #1
    Join Date
    May 2006

    Can you put a <ul>tag inside a <span> tag????????????????

    Hi Everybody! CowGirl Here!

    I am in a bit of a pickle and was hoping somebody can help me.

    Can you put a <ul> tag inside a <span> tag. For example, is the below code valid?

    <span><ul><li><a href="money-order.html">World Health Fund</a> (May 1, 2011)</li></ul></span>

    This code was written by an elance contractor who seems to know what he is doing. But, when I validate the above code in Dreamweaver, Dreamweaver says that you cannot put a <ul> tag inside a <span> tag. Note that I am using an older version of Dreamweaver (Dreamweaver CS3).

    So I am a bit confused. Is the above not valid code? Or is the above valid code, but my version of Dreamweaver is so old that it does not realize it is in fact valid code?

    Thank you!!!!!!!!!!!!!!!

  2. #2
    Join Date
    Sep 2006
    new york
    Could or should? I have not tried such. But remember <SPAN> is inline element and <UL> is block element. You should not nest a block element in an inline element.

    See, for instance, http://www.w3schools.com/tags/tag_span.asp or http://webdesign.about.com/od/htmltags/a/aa011000a.htm

    We all make mistakes/

  3. #3
    Join Date
    May 2006
    Auntnini, thank you for taking the time to read and reply to my post.

    I read the pages you linked to and now understand the error.

    Can I fix it be way of below (essentially replacing the <span> tag with a <div> tag)? Is it ok to use a <ul> tag as I did below (is to ok to place a <ul> tag by itself in the middle of a page, where the page is not one big <ul> tag from beginning to end)?

    <div class="generic_main_panel_full_width">
    <div class="generic_body_text">
    <p>sentence will be here</p>
    <div class="generic_body_text"><ul><li><a href="money-order.html">World Health Fund</a> (May 1, 2011)</li></ul></div>
    <p class="view_more"><a href="contributions_2.html">View older items</a></p>

    Thank you and have a pleasant day!

  4. #4
    Join Date
    Mar 2012
    That code would work, but I generally avoid nesting elements that are of the same class. There is nothing wrong with having more than one element of the same class on the same page, but if you are going to nest one inside the other, you may want individual style control over the elements in case it doesnt end up behaving how you want it to. You could also keep them in the same class and add unique IDs to each element in case that ends up being an issue as well. For example:

    <div class="generic_main_panel_full_width">
    <div class="generic_body_text" id="outer_div_1">
    <p>sentence will be here</p>
    <div class="generic_body_text" id="inner_div_1"><ul><li><a href="money-order.html">World Health Fund</a> (May 1, 2011)</li></ul></div>
    <p class="view_more"><a href="contributions_2.html">View older items</a></p>
    then you could give the divs an overall class by defining the "generic_body_text" in your CSS and if you need to add a specific style element to one div or the other then you just reference the id instead of the class and add your unique properties like so:

    border:thin solid;
    border:thick solid;
    technically there are other ways to do it as well, such as navigating the DOM in your CSS. I don't prefer to do that, its a little clunky to me. It's much easier(if you have access to the HTML) to add unique ids or have a larger variant of classes to assign.

  5. #5
    Join Date
    May 2006
    jc_rotor, thanks for taking the time to read and reply to my post.

    In my haste I neglected to change the name of the nested <div> in my above example code. I would change change the name of the nested div.

    But, I was reading reading about this issue and think I can just delete the <span> tag and not replace with a <div> tag or any other tag. Is this right?

    Thank you!!!!!!

  6. #6
    Join Date
    May 2006
    Please correct me if I am wrong, but the main purpose of including the nested <div> would be to style the <ul> enclosed in the nested <div>, but I could just as easily do that by attaching a class to the <ul> (for example, <ul class="class-list-1">).

  7. #7
    Join Date
    Sep 2006
    new york
    When possible, define the HTML element (the CSS rule "selector") in such a way as to avoid having to declare the id="idName" or class="className". I'm guessing that <span>, the <UL> and the <DIV>s were for some isolated visual effect.

    CSS rules can be "contextually" defined so they are more specific -- such as .genericText ul {color: red; } or .outer p { color: green; } or .inner p {color: purple;}, I frankly prefer .CLASS rules unless it is a very unique #ID page section.

  8. #8
    Join Date
    Aug 2012
    1453 Gingerwood ave, Milpitas CA 95035,
    I don't think you should use <ul> tag into a <span> tag.
    It may create problems in execution......

  9. #9
    Join Date
    Dec 2012
    thanks for the info, I have been very useful

    Elevadores de coches | Maquinaria para taller mecanico

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.14274 seconds
  • Memory Usage 2,934KB
  • 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
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (9)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • postbit_imicons
  • bbcode_parse_start
  • 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