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 )
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!!!
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!
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 )
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())
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).
Bookmarks