What is the difference between id and class Aký je rozdiel medzi id a class
ID tags are very similar to class tag, that's is why many people are confuse. ID tagy, sú veľmi podobné triedy značku, to je dôvod, prečo veľa ľudí mýli. I always wonder this myself...here is what I know... Vždy som vedel to sám ... tady je to, co já vím ...
ID tag can only be use once on a single page. ID tagu možno používať iba raz na jednu stranu. For example, you have <div id="something">content here</div> you can not use it again on the same page. Napríklad, máte <div id="something"> obsah tu </ div> nemožno použiť znovu na rovnakej stránke. Actually, you can use the same id tags on the same page as many time as you like because many browsers do not enforce the HTML/XHTML rules but it will give you an error if you validate your page at w3c when you have two identical id tags on the same page. V skutočnosti môžete použiť rovnaké identifikačné štítky na rovnakej stránke toľko času, koľko chcete, pretože veľa prehliadačov nemajú vymáhať HTML / XHTML pravidlá, ale to vám chybu, ak ste potvrdili svoju stránku na w3c, keď máte dva rovnaké id štítky na rovnakej stránke.
So each id tag must be unique on a single page. Takže každý id značka musí byť jednoznačná na jednej stránke. Since id are only use once each page, it is very useful to identified a specific content on a page. Vzhľadom k tomu, id je použiť iba raz za každej stránke, je veľmi užitočné identifikovať konkrétny obsah na stránke. For example, you have a id for the header and another unique id for the footer and if you want to have the link color for the header to be different from the footer you use id to separate the header and the footer. Napríklad máte id pre hlavičku a ďalšie jedinečné ID päty, a ak chcete mať súvislosť farby hlavičky musí byť odlišný od päty môžete použiť id oddeliť hlavičky a päty.
It might seem that class are more powerful than id because you can only use id once per page, but that is not true. Mohlo by sa zdať, že triedy sú silnejšie, ako identifikácia, pretože môžete používať iba id raz za stránku, ale to nie je pravda. ID are more powerful than class and it can overwrite the class tags if the style conflict with each other. ID sú mocnejší ako trieda a môže prepísať triedy značky, ak štýl konfliktu medzi sebou navzájom.
That's all for now. To je zatiaľ všetko. I hope this make sense. Dúfam, že to dáva zmysel. If you don't get it just post comment below and I'll do my best. Ak nechcete dostať len po komentár nižšie, a budem sa snažiť.
More info on "What is the difference between id and class" with the below links. Viac informácií na tému "Aký je rozdiel medzi ID a class" sa nižšie uvedené odkazy.
ID tag can only be use once on a single page. ID tagu možno používať iba raz na jednu stranu. For example, you have <div id="something">content here</div> you can not use it again on the same page. Napríklad, máte <div id="something"> obsah tu </ div> nemožno použiť znovu na rovnakej stránke. Actually, you can use the same id tags on the same page as many time as you like because many browsers do not enforce the HTML/XHTML rules but it will give you an error if you validate your page at w3c when you have two identical id tags on the same page. V skutočnosti môžete použiť rovnaké identifikačné štítky na rovnakej stránke toľko času, koľko chcete, pretože veľa prehliadačov nemajú vymáhať HTML / XHTML pravidlá, ale to vám chybu, ak ste potvrdili svoju stránku na w3c, keď máte dva rovnaké id štítky na rovnakej stránke.
So each id tag must be unique on a single page. Takže každý id značka musí byť jednoznačná na jednej stránke. Since id are only use once each page, it is very useful to identified a specific content on a page. Vzhľadom k tomu, id je použiť iba raz za každej stránke, je veľmi užitočné identifikovať konkrétny obsah na stránke. For example, you have a id for the header and another unique id for the footer and if you want to have the link color for the header to be different from the footer you use id to separate the header and the footer. Napríklad máte id pre hlavičku a ďalšie jedinečné ID päty, a ak chcete mať súvislosť farby hlavičky musí byť odlišný od päty môžete použiť id oddeliť hlavičky a päty.
It might seem that class are more powerful than id because you can only use id once per page, but that is not true. Mohlo by sa zdať, že triedy sú silnejšie, ako identifikácia, pretože môžete používať iba id raz za stránku, ale to nie je pravda. ID are more powerful than class and it can overwrite the class tags if the style conflict with each other. ID sú mocnejší ako trieda a môže prepísať triedy značky, ak štýl konfliktu medzi sebou navzájom.
That's all for now. To je zatiaľ všetko. I hope this make sense. Dúfam, že to dáva zmysel. If you don't get it just post comment below and I'll do my best. Ak nechcete dostať len po komentár nižšie, a budem sa snažiť.
More info on "What is the difference between id and class" with the below links. Viac informácií na tému "Aký je rozdiel medzi ID a class" sa nižšie uvedené odkazy.























