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

6850Re: [NH] css coding

Expand Messages
  • Rudolf Horbas
    May 7 2:46 PM
      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

      <li id="foo">
      <li id="foo">

      but this is OK:

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

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

    • Show all 10 messages in this topic