Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6014959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:46:02+00:00 2026-05-23T02:46:02+00:00

I have a nested shopping-type list that is grouped by type (and has descriptions

  • 0

I have a nested shopping-type list that is grouped by type (and has descriptions for each item).

What I’m wanting to do is have the last type scrolling in the list, until the point that it would scroll off the top of the list.

A list may declared as

<div id="items">
     <item-type>Type A</item-type>
     <description>a</description>
     <description>b</description>
     <description>c</description>
     <item-type>Type B</item-type>
     <description>d</description>
     <description>e</description>
     <description>f</description>
     <description>g</description>
     <description>h</description>
</div>

I’m using element types so that I can use #items > item-type:last-of-type in CSS3 to select the last element.

#items {
word-wrap: break-word;
overflow: auto;
height: 100%;
}

#items > * {
    display: block;
}

#items > item-type:last-of-type {
    position:absolute;
    bottom: 100px;   
}

So the only point now, is how do I keep it (effectively) position: relative; top: 0 to position: absolute; top: 0 using only CSS3?

I’m using FF4 and HTML5, so you can go all out; this won’t be supported on older browsers. Also, using calc() is fine.

The valid view options are be something like:

______________________________________
Type A            a             Type B 
  a               b               e
  b               c               f
  c             Type B            g
                  d               h
---------------------------------------

Where the lines are the visible area, and each column shows how it would appear given a certain amount of data (progression left to right)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:46:03+00:00Added an answer on May 23, 2026 at 2:46 am

    If I understand the problem correctly, you want to create something like the iPhone Contacts list. Looking at the solution someone already built it uses JavaScript. Also, I’ve thought about it and gone through all the CSS3 specs but cannot determine anything that could be used here to achieve the same affect without JavaScript.

    I knocked up a small demo, but again this uses JavaScript. I just don’t think it’s possible with pure CSS, although I’m sure someone will correct me if that’s not the case 🙂

    HTML

    <div id="items">
        <item-type>Type A</item-type>
        <description>a</description>
        <description>b</description>
        <description>c</description>
        <item-type>Type B</item-type>
        <description>d</description>
        <description>e</description>
        <description>f</description>
        <description>g</description>
        <description>h</description>
        <description>i</description>
        <description>j</description>
        <description>k</description>
        <description>l</description>
    </div>
    

    CSS

    #items {
        word-wrap: break-word;
        overflow: auto;
        height:100px;
        border:1px dashed red;
        width:200px;
    }
    
    #items > * {
        display: block;
    }
    
    #items > item-type {
        border:1px dashed blue;
        background-color:#fff;
        width:180px;
    }
    

    JavaScript (jQuery 1.6+)

    var itemsTop = $('#items').position().top;
    var itemTypeHeight = $('item-type').height();
    var itemTypeBottom = itemsTop + itemTypeHeight;
    
    $('#items').scroll(function() {
        $('item-type').each(function() {
            $(this).css({position:''});
    
            if ($(this).position().top < itemsTop + itemTypeHeight) {
                $(this).css({position:'fixed',top:itemsTop});
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep finding that if I have nested divs inside each other, and one
How have you explained nested arrays to a programmer. I'm thinking someone that has
I have nested xsl:for loops: <xsl:for-each select=/Root/A> <xsl:for-each select=/Root/B> <!-- Code --> </xsl:for> </xsl:for>
I have some nested tables that I want to hide/show upon a click on
I have a nested function to show/hide paragraphs news-ticker-style. The problem is that when
I have a nested movie clip instance that I want to access. The path
I have a three nested classes, Show, Season and Episode, where a show has
I have a shopping cart system in Cakephp, this table has all your usual
I have a function that adds shopping cart data to an array of arrays.
I have nested ajax calls that are not working in ie7. They work fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.