www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23

Thread: <div style> v.s <div id>

  1. #16
    Join Date
    Dec 2003
    Location
    Waardamme, Belgium
    Posts
    121
    CLASS is niet meer of minder krachtig dan ID. Beide hebben hun eigen functionaliteiten. ID is van toepassing op slechts één element ("geef mij je identiteitspapieren"), terwijl CLASS ("de schoolklas 6WB, naar voren komen!") een hele groep elementen aangeeft.

    Next time i'll write in chinese! Didn't it occur to you that most forum users are not fluent in english? The answer to your question is in the bold text.
    Quid Quid Latine Dictum Sit, Altum Viditur
    Thank you webdeveloper.com for providing these nice backlinks:
    Fotografie | Home Server (no need to click, it's for spiders )

  2. #17
    Join Date
    Nov 2005
    Posts
    22
    What kind of rude reply was this?? If you cannot give answers to somebody u have no right to belittle them!!! Even if most of forum users are not v conversant with english still the language of conversation here is english only and everybody uses this v language no matter how well they know the language!!!

  3. #18
    Join Date
    Nov 2005
    Posts
    22
    Hi Ihave found out of one of the reasons why ID is more powerful than class. There is an extremely useful function in Javascript called getElementById() that, as you might guess, lets you get a handle on a page element by its id, and not by its class. This I felt is a notable difference between the two. If somebody knows any other reason I will be delighted to know!

  4. #19
    Join Date
    Dec 2003
    Location
    Waardamme, Belgium
    Posts
    121
    The post in question was not about english or not, but about etiquette.
    For instance by checking that your keyboard has no letters missing
    Hw is ID more powerful than Class as u hv stated in yr reply?
    Some people need to translate the page using online translators, and they don't work well with this sort of text.

    And the translated text is:
    A class is a group of elements. "Class of 69" containing more than one student.
    It's mostly used for formatting, to give a consistent look to your pages (headings, definition lists, ... always in the same style. It's a very powerful way of ensuring that your whole site has the same layout.

    An ID is a single element ("Show me your ID!"). Most people only have one ID.
    What's important, is that a tag with an id (for instance<div id=aaa>) can contain other tags (with or without ID's), so the javascript command can apply to a whole page if you like: aaa.style.visibility='hidden'.
    fyi, document.getElementById('aaa').... does not work with all explorer versions.
    Quid Quid Latine Dictum Sit, Altum Viditur
    Thank you webdeveloper.com for providing these nice backlinks:
    Fotografie | Home Server (no need to click, it's for spiders )

  5. #20
    Join Date
    Nov 2005
    Posts
    22
    Allright from now on I will try to type in complete words. Thanks for your reply!!

  6. #21
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Quote Originally Posted by mdoigny
    aaa.style.visibility='hidden'.
    fyi, document.getElementById('aaa').... does not work with all explorer versions.
    True, but why would you be writing scripts for only IE4+? There are way more Firefox users than IE4 users, let alone users of other non-IE browsers, like Safari. (IE5+ supports document.getElementById())
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  7. #22
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,736
    Quote Originally Posted by swatisharma
    Hw is ID more powerful than Class as u hv stated in yr reply?
    Simply put this is because of the cascade order. Every element is scored and styles are applied based on these scores.

    Here's the basics
    HTML Code:
    Selector           |      Specificity
    -----------------------------------
    Universal selector |      0,0,0,0
    element identifier |      0,0,0,1
    class identifier   |      0,0,1,0
    id identifier      |      0,1,0,0
    embeded style      |      1,0,0,0
    Specificity values are sorted in left to right presedence; hence containing eight element identifiers, (0,0,0,8) has a lower specificity then a single class identifier (0,0,1,0).
    Last edited by bokeh; 12-14-2005 at 06:47 AM.

  8. #23
    Quote Originally Posted by Dark Dragon
    Umm..ok..but how do I make the stylesheet itself?
    Do I just write out the CSS code I want and save it in notepad?

    Sorry if this sounds silly to you but I never learned any of this in college nor did I ever get a clear picure of how to do it.

    Once again I thank you for your efforts.
    Or... Search for a CSS EDITOR, such as TopStyle

    "It's a small world, but I still wouldn't want to paint it."
    ---Steven Wright

    Jay on SurvivalRing
    Blog On!

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles