Nov 22, 2009

Lists, Unordered And Nested - some layout tricks

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > CSS (Cascading Style Sheets)

Lists, Unordered And Nested - some layout tricks

jlhaslip
Unordered lists are one of the three list types in (x)html. The others are Ordered Lists and Definiton Lists.

The w3c page of information about lists is here

They all behave the same as (x)html elements, but there are some differences between them. Read the Specification page linked above to know more that you need to know about them. Only difference between html4 and xhtml is the tags must be lower-case and closed for xhtml to be valid.

Ordered Lists have numbers preceding them. Paste the following code into a file and display it in your Browser to see the effect.
CODE
<ol>
                  <li>list item here</li>
                  <li>list item here</li>
              </ol>


Unordered Lists have other identifying character preceding them. Paste the following code into a file and display it in your Browser to see the effect.
CODE
<ul>
                    <li>list item here</li>
                    <li>list item here</li>
                </ul>


Definition lists are similar to Unordered Lists, but the unique characteristic of DL's is that DL's allow for more than one sub-level of detail under them.
CODE
<dl>
    <dt>dt item here</dt>
        <dd>dd item here</dd>
    </dt>
    <dt>dt item here</dt>
        <dd>dd item here</dd>
        <dd>dd item here</dd>
    </dt>
          </dl>

Notice how the second <dt> has an additional <dd> under the same <dt>? Can't do that with OL's or UL's *unless you nest them*, which is an option, of course.

Ordered List Example here
Unordered List Example here
Definition List Example here

And the (numbers or images preceding the lists) can be removed by declaring "{ list-style-type: none; }" in the style declaration for them. These example pages have little styling on them. They are pretty much default styling. Adjust them with padding and margin to suit your needs. Simple, huh?

A major point to notice is that Lists are block items by default, so they DO NOT require a wrapping DIV around them. A View > Source of that link with an example of nested UL's here will show that the UL can be given an ID and targetted by the CSS, classed, Floated or otherwise positioned the same as a div without any wrapper around it. Cool, huh? eh!

So save your div's for where you need them. Lists aren't on that list... (pun intended).

 

 

 


Comment/Reply (w/o sign-up)

Saint_Michael
Well to add a bit to the DL tags, in way those would be use primary as a way to set up a definition of a word and it source, something like this:


word
This is the meaning of the word and where it comes from.

.I do believe dictionary.com is using that tag, although I haven't verified that, but it would seem plauseiable to use it. Of course their are many other reasons, primaryily used for organzing information, heck you can even use this to set up work citations on a website if your doing a research project.

Comment/Reply (w/o sign-up)

rize619
hey how to set margin in lists ... like left margin ...margin b/w lists.?

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : lists, unordered, nested, layout, tricks

  1. Fixed Centred Layout
    Learn how to code that popular Centred/Fixed width layout... (2)
  2. Css Layout Help
    need help with my layout (8)
    http://billy61.trap17.com/divs/modulemaker.php i am rewriting my layout in divs instead of
    tables. the problem i have, is i need the divs with the "L" and "R" in them to extend all the way
    down to the bottom of the "content" div. also, what do i need to do to center the entire thing on
    the webpage? and it appears as though the top center div extends down into the middle div by
    like... maybe 5 px... is this just an illusion or is it really happening? this is the source html
    for the page: CODE "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml....
  3. [problem] Css Unordered List Display Problems Ie6 Bug
    Making unordered list under unordered list couses some padding to appe (2)
    I just started designing something that i thought is gonna be a really simple xHTML strict template.
    Everything is right except that i thought of using unordered list, some other list under that list.
    Well this is the code for the Menu that is cousing me problems CODE               List1
             List2                                    List 2 Sublist                 
                                                  This is really long text that explains a bunch of
    nothing3                          This is really long text that explains a bunch of nothing2 ....
  4. Definition Lists To Display Artist, Cd, And Track
    The semantically correct method. (0)
    I had a situation where I needed to code a listing of Bands, Albums (CD's), and theTracks on
    each of the albums. In order to develop the page in a semantic manner, the best way to develop the
    code was to use the Definition List, Definition Term and Definition Data tags as follows:
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> listing albums and tracks
    html tags, listing albums and tracks for different Bands, CSS
    dl tag" /> html tags." /> /* */ ....
  5. Help Fix My Site's Css/layout Issues
    Thanks for your time (9)
    The first issue has been resolved. Please goto Post #7 to see the current discussion.
    This is in reference to: http://facesofwar.org/cms/ When you load the page up in Firefox it
    works fine. But when you use I.E. it creates a nasty line break after each of the spans containing
    a dividing line. The relevant html is: CODE
    Home    Iraq    Alt.
    Media    Other    Contact And the relevant css (for
    1280 resolutions) is: CODE .menuOuter {     width: 100%;    ....
  6. Basic Css Layout Issue
    Floated Cell with similar height (5)
    Okay say I was building a site (what do you know I am!) and I want to use CSS. the problem being I
    don't know how to make a floated cell be the same height as another. FOr example CODE
    just some stuff over here! but... over here I have even more stuff to display
    now If I float the left to the left and the right to the right and set ther widths so that they
    will be beside eachother the left div is shorter then the right, which makes sense because there is
    more content in the right. I want to know how to make them the same heigh....
  7. Css Layout: Trouble With Ie
    the scrollbar and margin-bottom (4)
    I have a site which I'm developping and trying to get a frames-like layout design. But IE does
    not propperly show the scrollbox, its hidden behind the fixed divs of the top header and the bottom
    footer... Firefox does alright, so If you dont understand what I mean you can check it out here:
    http://web.cucea.udg.mx/ineser/alap/test.php Seems like Opera and Safari are doing also good...
    And also, the margin of #content (which is the main content area) is not working, becouse it does
    not go up above the footer, I don't know what is going on (that rule is ins....
  8. Unordered List Css Layout
    two rows of list and sublist (4)
    I have a layout which i want to do fully in CSS. Im having trouble centering the second list, or
    sublist which comes from the menu. It doesnt work in IE now, just firefox (Actually the page doesnt
    even show on IE, nor Opera, i dont know why). I just want it to appear centered, when im hovering
    the main list, not left aligned... Here's the link, youll understand when you see it...
    http://web.cucea.udg.mx/cucea/graphix/level5/ I also want to fix the background, (i removed the
    background for now) becouse when i hover the sublist items, the background becomes bigge....
  9. Moving Ads With Css Layout On Free Hosting
    CSS help (7)
    Can anyone help me how to move top banner from free host? I hear that can be done with css!....
  10. Css Layout Generator - *free*
    Generate a CSS layout for your site (8)
    pretty powerful css layout generator. /smile.gif' border='0' style='vertical-align:middle'
    alt='smile.gif' /> and it's freely available online.
    http://www.csscreator.com/version2/pagelayout.php QUOTE To create your layout select the
    structural elements your site requires (header, footer, columns). Then specify a size in the field
    provided and choose a background color from the color chooser below. The color chooser changes
    values as you move your mouse along a row. To set a value click on the color row to release click
    again. Once the color in the box is th....
  11. Css How To Use It?
    how do you use it to make a custom layout 4 website? (3)
    how you make a custom layout and what is the coding and stuff?....
  12. Css Files, Get Your Css Files Here! [resolved]
    Want a nice CSS layout? (0)
    Alright, if anybody wants a CSS layout; I'll make one for you! Just tell me what you want the
    background color to be, main font color, and the link colors! Then later in the topic I'll post
    them and I'll post the username of the user that requested next to them so you know which one is
    yours! So if anyone wants a CSS File; Ask Mike! >_>....

    1. Looking for lists, unordered, nested, layout, tricks

Searching Video's for lists, unordered, nested, layout, tricks
See Also,
advertisement


Lists, Unordered And Nested - some layout tricks

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com