it sounds like perhaps you're trying to apply the wrong programming paradigm
to css and html. Css is declarative, kind of like sql. It's neither
functional nor procedural and it doesn't manipulate objects or variables.
divs and lists (ul and li) are structural html elements not containers (iow
no, it's not analogous to an array or vector). It's a little confusing
because of course they can contain other structural elements, but only for
the sake of structure, not as objects to be manipulated.
Regarding oo-style programming, you might google mvc or
Model-View-Controller pattern where one separates out the user interface
(html and css in web apps, java awt or swing classes in java, asp.net in
..NET, etc etc.) from the Controller (functionality provided by whatever
programming language) and the Model (usually business layer or database).
That might help to delineate the functionality that you were looking for in
What helped me to "get it" was just to treat css like sql only css talks to
the browser where sql talks to the database.
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/