css element within element....

Discussion in 'HTML' started by WindAndWaves, Feb 2, 2005.

  1. WindAndWaves

    WindAndWaves Guest

    Hi Gurus

    This question relates to stylesheets.

    Is it possible to say to define the behaviour of classes, elements, etc... within other elements

    For example of the A-elements within the <DIV CLASS="content">, if so, how do i do that?

    Sorry I am really new to this kind of thing and I do not have a computer background.

    I have seen stuff around like A > .content {....} is that the kind of thing I should be using? If so, what should I watch for?

    Cheers


    - Nicolaas
     
    WindAndWaves, Feb 2, 2005
    #1
    1. Advertising

  2. WindAndWaves

    rf Guest

    "WindAndWaves" <> wrote

    > Hi Gurus


    Gurus is out to lunch. I'm filling in.

    >
    > This question relates to stylesheets.
    >
    > Is it possible to say to define the behaviour of classes, elements, etc...

    within other elements
    >
    > For example of the A-elements within the <DIV CLASS="content">, if so, how

    do i do that?

    div.content a

    Check the specs:
    http://www.w3.org/TR/REC-CSS2/selector.html
     
    rf, Feb 2, 2005
    #2
    1. Advertising

  3. WindAndWaves wrote:
    > This question relates to stylesheets.
    > Is it possible to say to define the behaviour of classes, elements,

    etc... within other elements

    Yes, see the source of this page for an example.
    http://www.redmelon.net/tstme/4corners/

    --
    -=tn=-
     
    Travis Newbury, Feb 2, 2005
    #3
  4. WindAndWaves

    Steve Pugh Guest

    "WindAndWaves" <> wrote:

    >This question relates to stylesheets.
    >
    >Is it possible to say to define the behaviour of classes, elements, etc... within other elements


    Yes.

    >For example of the A-elements within the <DIV CLASS="content">, if so, how do i do that?


    div.content a {foo:bar;}

    >Sorry I am really new to this kind of thing and I do not have a computer background.


    The word you are looking for is "selector". A selector in CSS is the
    part of a style rule that specifies which elements the properties
    deined the in rule apply to. CSS includes a large number of different
    selectors that can be combined in many possiblle ways.

    The simplest selector is an element selector
    div {}
    which selects all elements of that type.
    A class selector
    ..foo {}
    selects all elements with that class. These can be combined to select
    all elements of a given type with that class.
    div.foo {}

    You're asking about the descendent selector that selects all elements
    that descendents of another element. The descendent selector is just a
    space.

    div p {}
    selects all p elements that are descendets of divs.
    div.foo p b.bar {}
    selects all b elements with a class of bar that are descendents of p
    elements that are themselves descendents of div elements with a class
    of foo.

    See http://www.w3.org/TR/CSS21/selector.html

    But be aware that some browsers (stand up IE) don't support a lot of
    the selectors.
    http://www.blooberry.com/indexdot/css/syntax/selectors/selectors.htm
    isn't fully complete or up to date but does tell you what IE6 does and
    doesn't support which is the most important thing to know today.

    >I have seen stuff around like A > .content {....} is that the kind of thing I should be using?


    That's a child selector. It works like a descendent selector but only
    applies to immediate children.
    <div class="foo">
    <p></p>
    <div>
    <p><p>
    </div>
    <p></p>
    </div>

    ..foo > p {}
    applies to the first and third paragraphs because they are children of
    the element with class foo but not to the second because it is a
    grandchild.

    >If so, what should I watch for?


    IE doesn't support child selectors. If you write it with spaces then
    IE will treat it as a descendent selector. If you write it without
    spaces then IE will ignore it.
    ..foo > p is treated as .foo p
    ..foo>p is ignored altogether.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Feb 2, 2005
    #4
  5. On Thu, 3 Feb 2005 00:17:21 +1300, WindAndWaves <> wrote:

    > This question relates to stylesheets.
    >


    Then why do you come to alt.html?
    I've added ciwas, and f'up set hence.

    > Is it possible to say to define the behaviour of classes, elements, etc...
    > within other elements
    >
    > For example of the A-elements within the <DIV CLASS="content">, if so, how do
    > i do that?
    >
    > Sorry I am really new to this kind of thing and I do not have a computer
    > background.
    >


    That's okay. We've all started with CSS at some time in our lives. But, if
    you're that new with this, perhaps you should start with on-line tutorials to
    get some idea of how CSS works:

    <http://www.w3.org/MarkUp/Guide/Style.html> for example.

    There is much more. Google for it.

    As a rule of thumb:
    - Start styling the elements that you use in the markup of your pages, for
    example <p>, <h#>, <div> and get some experience with that, get a feel for what
    CSS is and does;
    - When comfortable with styling the single elements, experiment some with
    creating (containing) divisions and setting specific styles for those and the
    elements inside them, but then you are already somewhat advanced.

    Also, lurk in some of the ciwa* groups, especially ciwas. You can learn a great
    deal from that. Last, look at the style sheets of sites you visit and like. Try
    to understand what you see (combined with the markup).

    Play around with (correct) markup and css and when you've created something in
    your personal sandbox, there is no harm in comming back here (meaning ciwas) and
    ask for help with specific problems. Don't forget to validate code (both markup
    and styles) before you ask for help.

    <http://validator.w3.org/> for markup and
    <http://jigsaw.w3.org/css-validator/> for css

    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 2, 2005
    #5
  6. WindAndWaves

    Els Guest

    WindAndWaves wrote:

    > Hi Gurus
    >
    > This question relates to stylesheets.
    >
    > Is it possible to say to define the behaviour of classes,
    > elements, etc... within other elements


    Yes :)

    > For example of the A-elements within the <DIV
    > CLASS="content">, if so, how do i do that?


    div.content a{styles...}

    > Sorry I am really new to this kind of thing and I do not
    > have a computer background.


    Handy tool for you:
    http://gallery.theopalgroup.com/selectoracle/

    > I have seen stuff around like A > .content {....} is that
    > the kind of thing I should be using? If so, what should I
    > watch for?


    No, that's just a hack to get different browsers to do
    different things.

    --
    Els
    http://locusmeus.com/
    Sonhos vem. Sonhos vão. O resto é imperfeito.
    - Renato Russo -
     
    Els, Feb 2, 2005
    #6
  7. WindAndWaves

    Els Guest

    Els wrote:
    [...]

    Oops, didn't see all the other replies before I pressed send..

    --
    Els
    http://locusmeus.com/
    Sonhos vem. Sonhos vão. O resto é imperfeito.
    - Renato Russo -
     
    Els, Feb 2, 2005
    #7
  8. On 2 Feb 2005 11:46:50 GMT, Els <> wrote:

    > WindAndWaves wrote:
    >
    >> I have seen stuff around like A > .content {...} is that
    >> the kind of thing I should be using? If so, what should I
    >> watch for?

    >
    > No, that's just a hack to get different browsers to do
    > different things.
    >


    Come again? Using the '>' in a style selector means the author wants all direct
    decendents, also know as 'children' to render with a specific style. Thus the
    '>' in a selector creates a child selector.
    It is only if the spaces are left out, 'foo>bar' instead of 'foo > bar' (that
    gets mis-interpreted by IE), that the styles for the selector are ignored by a
    certain obscure and faulty browsers aka as IE :) . Knowing that, might seduce a
    webauthor into using the child selector without spaces as a 'hack to get
    different browsers do different things'. But that certainly was not the intended
    use for the child selector.

    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 2, 2005
    #8
  9. WindAndWaves

    rf Guest

    "Barbara de Zoete" <> wrote
    > On Thu, 3 Feb 2005 00:17:21 +1300, WindAndWaves <> wrote:
    >
    > > This question relates to stylesheets.


    > Then why do you come to alt.html?


    Probably because the non-existant charter for alt.html includes just about
    everything that is done client side.

    Besides, these days CSS should be considered an integral part of writing
    "HTML".

    > I've added ciwas, and f'up set hence.


    And I have removed it and reset the followups
     
    rf, Feb 2, 2005
    #9
  10. On Wed, 02 Feb 2005 11:57:33 GMT, rf <rf@.invalid> wrote:

    > "Barbara de Zoete" <> wrote
    >> On Thu, 3 Feb 2005 00:17:21 +1300, WindAndWaves <> wrote:
    >>
    >> > This question relates to stylesheets.

    >
    >> Then why do you come to alt.html?

    >
    > Probably because the non-existant charter for alt.html includes just about
    > everything that is done client side.
    >
    > Besides, these days CSS should be considered an integral part of writing
    > "HTML".
    >


    What was the original logic of creating a newsgroup ciwas? Why shouldn't a
    discussion on styles, selectors et cetera be better of there?


    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 2, 2005
    #10
  11. WindAndWaves

    Dylan Parry Guest

    Barbara de Zoete wrote:

    > What was the original logic of creating a newsgroup ciwas?


    Probably the same logic as that for creating ciwah. Neither of which are
    in the same hierarchy as alt.html.

    --
    Dylan Parry
    http://webpageworkshop.co.uk -- FREE Web tutorials and references
     
    Dylan Parry, Feb 2, 2005
    #11
  12. On Wed, 02 Feb 2005 12:03:51 +0000, Dylan Parry <> wrote:

    > Barbara de Zoete wrote:
    >
    >> What was the original logic of creating a newsgroup ciwas?

    >
    > Probably the same logic as that for creating ciwah. Neither of which are in
    > the same hierarchy as alt.html.
    >


    The second question remains:
    >> Why shouldn't a discussion on styles, selectors et cetera be better of there?



    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 2, 2005
    #12
  13. WindAndWaves

    Dylan Parry Guest

    Barbara de Zoete wrote:

    > The second question remains:
    >>> Why shouldn't a discussion on styles, selectors et cetera be better
    >>> of there?


    No one is saying that it wouldn't be better off there, but your logic
    was stating that "a discussion on styles, selectors et cetera" should
    *only* be posted there. This is clearly wrong.

    --
    Dylan Parry
    http://webpageworkshop.co.uk -- FREE Web tutorials and references
     
    Dylan Parry, Feb 2, 2005
    #13
  14. WindAndWaves

    rf Guest

    "Barbara de Zoete" <> wrote

    > What was the original logic of creating a newsgroup ciwas? Why shouldn't a
    > discussion on styles, selectors et cetera be better of there?


    Look at the "alt" in alt.html.

    Note the absense of "alt" in ciwas.

    alt means alternative. No holds bared. Anything goes.

    ciwas (and the rest of the big 8) have their place, as die hard stick with
    the rules places where one can only talk about CSS and nothing else. Drift
    off into javascript over there and you are in deep shit. You will be
    referred to clj and then you will be admonished for multiposting!

    Here we diverge.

    ciwas is the technicians dining room. alt.html is the local pub.

    I personally audit many of the c* groups. I only post to alt goups, when I
    remember where I am :)
     
    rf, Feb 2, 2005
    #14
  15. On Wed, 02 Feb 2005 12:17:03 +0000, Dylan Parry <> wrote:

    > Barbara de Zoete wrote:
    >
    >> The second question remains:
    >>>> Why shouldn't a discussion on styles, selectors et cetera be better of
    >>>> there?

    >
    > No one is saying that it wouldn't be better off there, but your logic was
    > stating that "a discussion on styles, selectors et cetera" should *only* be
    > posted there. This is clearly wrong.
    >


    It could be, if I stated that. Which I didn't.
    The context of the question of OP pointed to ciwas as more appropriate, as there
    was no markup related topic at all. More appropriate. It is not unusual to move
    a discussion to another newsgroup if it is a more appropriate group.

    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 2, 2005
    #15
  16. On Wed, 02 Feb 2005 12:17:21 GMT, rf <rf@.invalid> wrote:

    > "Barbara de Zoete" <> wrote
    >
    >> What was the original logic of creating a newsgroup ciwas? Why shouldn't a
    >> discussion on styles, selectors et cetera be better of there?

    >
    > Look at the "alt" in alt.html.
    >
    > Note the absense of "alt" in ciwas.
    >
    > alt means alternative. No holds bared. Anything goes.
    >


    In the hierarchy alt.* anything goes for sure. In a named group, like alt.html,
    there are things on topic and off topic. If anything goes, how about a
    discussion on fuel shortage in the coming decade?

    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 2, 2005
    #16
  17. WindAndWaves

    rf Guest

    "Barbara de Zoete" <> wrote

    > In the hierarchy alt.* anything goes for sure. In a named group, like

    alt.html,
    > there are things on topic and off topic. If anything goes, how about a
    > discussion on fuel shortage in the coming decade?


    Fuel shortages would probably be off topic for alt.html. Have you visited
    alt.www.webmaster recently?
     
    rf, Feb 2, 2005
    #17
  18. On Wed, 02 Feb 2005 12:32:02 GMT, rf <rf@.invalid> wrote:

    > "Barbara de Zoete" <> wrote
    >
    >> In the hierarchy alt.* anything goes for sure. In a named group, like

    > alt.html,
    >> there are things on topic and off topic. If anything goes, how about a
    >> discussion on fuel shortage in the coming decade?

    >
    > Fuel shortages would probably be off topic for alt.html.


    lol

    > Have you visited alt.www.webmaster recently?
    >


    I never go there. I'm suspicious about all said by one who claims to be a
    web_master_. Anything interesting in that group?


    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 2, 2005
    #18
  19. WindAndWaves

    Dylan Parry Guest

    Barbara de Zoete wrote:

    [alt.www.webmaster]
    > Anything interesting in that group?


    Yes, sometimes. It's less technical than even alt.html, and generally
    less on-topic. There has been a much greater number of marked OT posts
    there recently, but the occasional good discussion arises. A lot of the
    folk who frequent here also post there too, but I find it a more
    "relaxed" and general group than alt.html.

    --
    Dylan Parry
    http://webpageworkshop.co.uk -- FREE Web tutorials and references
     
    Dylan Parry, Feb 2, 2005
    #19
  20. WindAndWaves

    WebMaster Guest

    "Barbara de Zoete" <> wrote in message
    news:eek:pslkkrtn1x5vgts@zoete_b...
    > On Wed, 02 Feb 2005 12:17:21 GMT, rf <rf@.invalid> wrote:
    >
    > > "Barbara de Zoete" <> wrote
    > >
    > >> What was the original logic of creating a newsgroup ciwas? Why

    shouldn't a
    > >> discussion on styles, selectors et cetera be better of there?

    > >
    > > Look at the "alt" in alt.html.
    > >
    > > Note the absense of "alt" in ciwas.
    > >
    > > alt means alternative. No holds bared. Anything goes.
    > >

    >
    > In the hierarchy alt.* anything goes for sure. In a named group, like

    alt.html,
    > there are things on topic and off topic. If anything goes, how about a
    > discussion on fuel shortage in the coming decade?


    there won't be any shortage. We had that topic back in the seventies too
    (and in the eighties, and...) :)
    There will be higher prices (due to nonexistent shortage) though (also had
    that in the seventies)...

    Rudy

    >
    > --
    > ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    > | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    > | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    > |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    > `-------------------------------------------------- --<--@ ------------'
     
    WebMaster, Feb 2, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MSNews
    Replies:
    1
    Views:
    2,733
    Alvin Bruney [MVP]
    Apr 22, 2004
  2. Fred Flintstone
    Replies:
    2
    Views:
    9,177
    Fred Flintstone
    Sep 13, 2006
  3. mark4asp
    Replies:
    2
    Views:
    2,220
    Harry Haller
    Nov 7, 2006
  4. MU
    Replies:
    2
    Views:
    10,921
    gerry
    Jan 14, 2009
  5. PeteOlcott
    Replies:
    1
    Views:
    949
    Mukul Gandhi
    Feb 5, 2009
Loading...

Share This Page