Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Target every element inside another element

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23419
    john010117
    Member

    Hi – have another question.

    Normally, when designers want to set a simple CSS reset, they’d do something like this:

    Code:
    * { margin:0; padding:0; }

    I was wondering if I could do something like this:

    Code:
    #container * { margin:0; padding:0; }

    What I’m trying to do is remove the margin/padding of every element inside a particular div, but not anything else outside of the div.

    Is this possible?

    #50610
    soap
    Participant

    Yep pretty sure that will work. Have you tried it?

    #50615
    john010117
    Member

    Is that seriously the correct syntax? Damn, I’m good. :D Yes, it worked. Thanks.

    #50628
    soap
    Participant

    Good work. I love using it for things like this: #content > *:first-child {margin-top:0;}

    It has many great uses that little asterisk.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.