Loading ...
Sorry, an error occurred while loading the content.
 

Re: [NH] css coding

Expand Messages
  • Rudolf Horbas
    ... That s id vs. class. In your example, you would have in the html part: is only allowed once anyway. For elements
    Message 1 of 10 , May 7, 2010
      Brother Gabriel-Marie schrieb am 06.05.2010 23:10:

      > I just recently started to understand what the id attributes are for in
      > the html code. But what is the difference between using
      > tagname#something and tagname.something?
      >
      > body#subpage {background: #eeebe9 url(images/bg_alt.jpg) repeat-x;}
      >
      > body.subpage {background: #eeebe9 url(images/bg_alt.jpg) repeat-x;}

      That's id vs. class.
      In your example, you would have in the html part:

      <body id="subpage" class="subpage">

      <body> is only allowed once anyway.

      For elements that appear more than once, you can't repeat the id; you'd
      use class instead.

      So you can't have

      <ul>
      <li id="foo">
      <li id="foo">
      </ul>

      but this is OK:

      <ul>
      <li id="foo" class="bar">
      <li id="foo2" class="bar">
      </ul>

      So, take the attribute names literally: An id is something unique, while
      a class is a group of similar elements.

      HTH,
      Rudi
    • Greg Chapman
      Hi B G-M, ... Just to emphasise why you must only have one ID on a page. It can be used as an anchor, i.e. you can place a link to an HTML element with an ID.
      Message 2 of 10 , May 7, 2010
        Hi B G-M,

        On 07 May 10 22:46 Rudolf Horbas <rhorbas@...> said:
        > So, take the attribute names literally: An id is something unique,
        > while a class is a group of similar elements.

        Just to emphasise why you must only have one ID on a page. It can be
        used as an anchor, i.e. you can place a link to an HTML element with
        an ID.

        Obviously, that can't be done with a CLASS as the browser wouldn't
        know which one to jump to!

        Greg
      • Axel Berger
        ... If I remember it correctly, but I can t find a reference to verify it, an ID must not only be unique per kind of element but must be unique on a page. So
        Message 3 of 10 , May 7, 2010
          Greg Chapman wrote:
          > why you must only have one ID on a page. It can be
          > used as an anchor,

          If I remember it correctly, but I can't find a reference to verify it,
          an ID must not only be unique per kind of element but must be unique on
          a page.

          So not only can't you have two <P ID="standard"> on the same page but
          you also can not have a
          <P ID="standard"> and a <H4 ID="standard">.

          I believe I'm right, but I'd have preferred to be able to verify that
          before posting.

          Axel
        • Greg Chapman
          Hi Axel, ... You are right! It s why I made the amplification to Rudolf s answer. I d hoped that the point about it being able to be used as an anchor would
          Message 4 of 10 , May 7, 2010
            Hi Axel,

            On 07 May 10 23:08 Axel Berger <Axel-Berger@...> said:
            >
            > I believe I'm right, but I'd have preferred to be able to verify
            > that before posting.

            You are right! It's why I made the amplification to Rudolf's answer.
            I'd hoped that the point about it being able to be used as an anchor
            would make the point.

            It's the ID alone that is the anchor not the element/id combination.

            The browser wouldn't know where to jump if there was both a "<p
            id="jumphere"> and an <h3 id=jumphere">.

            Greg
          • Scott Fordin
            In CSS syntax, # is an id selector, and is used for a single unique element. By contrast, the . is for class selectors, and are typically used multiple
            Message 5 of 10 , May 7, 2010
              In CSS syntax, "#" is an id selector, and is used for a single unique
              element. By contrast, the "." is for class selectors, and are typically
              used multiple times on a page, often across multiple or groups of
              elements you want to have share some common characteristics. To put
              it another way, id selectors (#) are used for creating unique,
              referenceable elements on a page, where as class selectors are used
              for creating style definitions that can be reused among different
              elements.

              You might want to take a look here for more information:

              http://www.w3schools.com/css/css_id_class.asp

              Hope this helps,

              Scott

              Brother Gabriel-Marie wrote:
              >
              >
              > Hello, y'all!
              >
              > I just recently started to understand what the id attributes are for in
              > the html code. But what is the difference between using
              > tagname#something and tagname.something?
              >
              > body#subpage {background: #eeebe9 url(images/bg_alt.jpg) repeat-x;}
              >
              > body.subpage {background: #eeebe9 url(images/bg_alt.jpg) repeat-x;}
              >
              > Thanks!
              > - Brother Gabriel-Marie
              >
              >
            • brother.gabriel
              Thanks, y all! I knew there was a simple explanation; I sort of understood but sort of didn t. Now there is no question. This is a good forum! Next thing I
              Message 6 of 10 , May 9, 2010
                Thanks, y'all! I knew there was a simple explanation; I sort of understood but sort of didn't. Now there is no question. This is a good forum! Next thing I am getting into is PHP-MySQL, and that will be a whole other matter.

                --- In ntb-html@yahoogroups.com, Scott Fordin <scott@...> wrote:
                >
                > In CSS syntax, "#" is an id selector, and is used for a single unique
                > element. By contrast, the "." is for class selectors, and are typically
                > used multiple times on a page, often across multiple or groups of
                > elements you want to have share some common characteristics. To put
                > it another way, id selectors (#) are used for creating unique,
                > referenceable elements on a page, where as class selectors are used
                > for creating style definitions that can be reused among different
                > elements.
                >
                > You might want to take a look here for more information:
                >
                > http://www.w3schools.com/css/css_id_class.asp
                >
                > Hope this helps,
                >
                > Scott
                >
                > Brother Gabriel-Marie wrote:
                > >
                > >
                > > Hello, y'all!
                > >
                > > I just recently started to understand what the id attributes are for in
                > > the html code. But what is the difference between using
                > > tagname#something and tagname.something?
                > >
                > > body#subpage {background: #eeebe9 url(images/bg_alt.jpg) repeat-x;}
                > >
                > > body.subpage {background: #eeebe9 url(images/bg_alt.jpg) repeat-x;}
                > >
                > > Thanks!
                > > - Brother Gabriel-Marie
                > >
                > >
                >
              • Axel Berger
                ... No it s not! This is a mailing list, and that fact alone is ninety percent of the reason why we re better than fora - the rest is just us. Axel
                Message 7 of 10 , May 9, 2010
                  "brother.gabriel" wrote:
                  > This is a good forum!

                  No it's not! This is a mailing list, and that fact alone is ninety
                  percent of the reason why we're better than fora - the rest is just us.

                  Axel
                • Mick Housel
                  The PHP and MySQL for Dynamic Web Sites book(s) by Larry Ullman are very good resource for getting a working knowledge & understanding of how they work
                  Message 8 of 10 , May 9, 2010
                    The PHP and MySQL for Dynamic Web Sites book(s) by Larry Ullman are very
                    good resource for getting a working knowledge & understanding of how
                    they work together. I'd suggest knowing at least the basics of PHP
                    before attempting to do MySQL with it.

                    Mick

                    On 5/9/2010 12:06 PM, brother.gabriel wrote:
                    >
                    >
                    > Thanks, y'all! I knew there was a simple explanation; I sort of
                    > understood but sort of didn't. Now there is no question. This is a good
                    > forum! Next thing I am getting into is PHP-MySQL, and that will be a
                    > whole other matter.
                  • brother.gabriel
                    Okay! You say tomatoe, I say tomatoh. Anyways, I agree with you completely that it is better than those php web-forums. I much prefer this email-based
                    Message 9 of 10 , May 17, 2010
                      Okay! You say tomatoe, I say tomatoh. Anyways, I agree with you completely that it is better than those php web-forums. I much prefer this email-based *ahem* forum. I hate logging onto sites all the time and messing around with passwords. And here I get all my correspondence saved into my Thunderbird. I appreciate the Yahoo Groups for that.
                      -BGM

                      --- In ntb-html@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                      >
                      > "brother.gabriel" wrote:
                      > > This is a good forum!
                      >
                      > No it's not! This is a mailing list, and that fact alone is ninety
                      > percent of the reason why we're better than fora - the rest is just us.
                      >
                      > Axel
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.