Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   Graphic Design (http://siteownersforums.com/forumdisplay.php?f=23)
-   -   The Difference Between ID and Class (http://siteownersforums.com/showthread.php?t=144684)

doccs us 08-25-2014 10:33 PM

The Difference Between ID and Class
 
The Difference Between ID and Class

ledtubelight 08-25-2014 11:40 PM

ID's
ID, short for fragment identifier, is a beautiful attribute, but it's very easy to use them improperly. You can only use an ID name once in any XHTML or HTML document.

Classes
Classes, like ID's, can also be used to in JavaScript scripts, but unlike ID's, they can be used multiple times in the same HTML document.

freelancer 08-26-2014 01:37 AM

Quote:

Originally Posted by ledtubelight (Post 409865)
ID's
ID, short for fragment identifier, is a beautiful attribute, but it's very easy to use them improperly. You can only use an ID name once in any XHTML or HTML document.

Classes
Classes, like ID's, can also be used to in JavaScript scripts, but unlike ID's, they can be used multiple times in the same HTML document.

Good description. Thanks for the information.

johnstyle 08-26-2014 09:06 PM

ID's are unique
Each element can have only one ID
Each page can have only one element with that ID
Classes are not unique
We can use the same class on multiple elements.
We can use multiple classes on the same element.

pxljobs 08-10-2016 10:57 PM

ID:
Element can only one id,each page have only one element with id it is unique one.
Class:
It will be used for java script it will used multiple times in same html document.

nomi147 08-11-2016 02:45 AM

A lot of web designers new to the field aren't aware of the differences between ID's and classes. So here's a fairly brief article outlining proper and improper uses of the two.

Claire_Anderson 08-12-2016 12:21 AM

In general, you can can create a class in a style sheet and add some styling code in it and you can use that class name to apply same type of styles to other objects in the UI like text or headings or paragraph without copying the code in the style sheet again.

hemaweb 08-19-2016 01:55 AM

ID:
id short for fragment identifier, is a beautiful attribute, but it's very easy to use them improperly. You can only use an ID name once in any XHTML or HTML document. Duplicate ID tags will cause your page to fail validation, and can have negative effects when using JavaScript with them.
Classes:
classes like ID's, can also be used to in JavaScript scripts, but unlike ID's, they can be used multiple times in the same HTML document.

daniewalker 08-20-2016 01:40 AM

ID are Unique
Each element can have only one ID
Each page can have only one element with that ID

Class are Not Unique
You can use the same class on multiple elements.
You can use multiple classes on the same element.

adlersmith 08-29-2016 11:01 PM

The ID selector is further specific than class, and the natural stream has been overridden. Class allocates you to prevent duplicating styles unnecessarily. You can also consist of several classes using only one attribute.

SaraSanjay 09-06-2016 01:56 AM

ID's
ID, short for fragment identifier, is a beautiful attribute, but it's very easy to use them improperly. You can only use an ID name once in any XHTML or HTML document.

Classes
Classes, like ID's, can also be used to in JavaScript scripts, but unlike ID's, they can be used multiple times in the same HTML document.
__________________

avemlfy 03-27-2017 02:11 AM

id is use with # and class use with '.' .

hongta 03-28-2017 07:14 AM

ID's are unique
Each element can have only one ID
Each page can have only one element with that ID
Classes are NOT unique
You can use the same class on multiple elements.
You can use multiple classes on the same element.

tourism123 03-28-2017 07:59 AM

ID's are unique.Classes are not unique


All times are GMT -7. The time now is 07:56 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.