SEOClerks

What is the difference between id and class?



Write the reason you're deleting this FAQ

What is the difference between id and class?

In CSS (Cascading Style Sheets) you can use both "id" and "class" to select elements to style. For example, you can use:

<div id="test">Text</div>

and use "#test" on your css page to style the text in between the "div" tags. My questions is what is the different between "id" and "class"? Surely I can replace the above "id" with "class", ie.
<div class="test">Text</div>

and use ".test" on your css page and it will provide the same results.

When do you use the "id" and "class" and what is the difference between the two?

Thanks.

Comments

Please login or sign up to leave a comment

Join
eziscript
Unlike the id selector, the class selector is most often used on several elements. This allows you to set a particular style for many HTML elements with the same class. The class selector uses the HTML class attribute, and is defined with a "." A simple way to look at it is that an id is unique to only one element.

In Simple Word:

A class is a type of item and the id is the unique name of an item on the page.


Examples of ids are: main-content, header, footer, or left-sidebar.

Thanks,



Are you sure you want to delete this post?

overcast
Here's how I remember it. Class is meant to design several elements. And id is used for unique elements which appear specifically in some points. You may find that reusing id elements often lead to issues when you wish to recurring use them. If you are planning to use them recurring then go with the class. That's how you can have the uniform and non breaking design with CSS.



Are you sure you want to delete this post?

Order Now
Process Time: 0.035413026809692

Possible Duplicate queries found!
MatchCountSQLScript
SELECT * FROM `questions` as q JOIN categories_faq as c ON q.catid=c.CATID WHERE (q.status=1 OR (q.status=2 AND userid='') ) AND q.quesid='20440'1SELECT q.*, c.seo as CatSEO, c.name as CatName, c.parentid FROM `questions` as q JOIN categories_faq as c ON q.catid=c.CATID WHERE (q.status=1 OR (q.status=2 AND userid='') ) AND q.quesid='20440'

/opt/clerks-staging/docroot/viewfaq.php 496 () ()

SELECT * FROM seoclerks.members WHERE USERID='311920'1SELECT * FROM seoclerks.members WHERE USERID='311920'

/opt/clerks-staging/docroot/include/functions/includes/member.php 445 GetAllUserDetails() ()

SELECT * FROM seoclerks.members WHERE USERID=3119201SELECT googleplus_profile FROM seoclerks.members WHERE USERID=311920

/opt/clerks-staging/docroot/include/functions/main.php 16914 GetGooglePlusProfileFromId() ()

SELECT * FROM ratings_faq as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=20440 LIMIT 51SELECT m.username FROM ratings_faq as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=20440 LIMIT 5

/opt/clerks-staging/docroot/include/functions/main.php 17159 GetVoters() ()

SELECT * FROM answers a, seoclerks.members b WHERE a.quesid='20440' AND a.userid=b.USERID and b.status='1' AND a.status=1 ORDER BY a.combined_votes DESC, a.date_answered asc1SELECT a.answer, a.USERID, a.upvotes, a.downvotes, a.ansid, a.parentid, a.combined_votes, a.date_answered, b.username, b.userlevel, b.profilepicture FROM answers a, seoclerks.members b WHERE a.quesid='20440' AND a.userid=b.USERID and b.status='1' AND a.status=1 ORDER BY a.combined_votes DESC, a.date_answered asc

/opt/clerks-staging/docroot/viewfaq.php 1245 () ()

SELECT * FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=111349 LIMIT 51SELECT m.username FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=111349 LIMIT 5

/opt/clerks-staging/docroot/include/functions/main.php 17159 GetVoters() ()

SELECT * FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=122689 LIMIT 51SELECT m.username FROM ratings_faqanswers as r, seoclerks.members as m WHERE r.USERID=m.USERID AND r.upvote=1 AND r.PID=122689 LIMIT 5

/opt/clerks-staging/docroot/include/functions/main.php 17159 GetVoters() ()

UPDATE questions SET total_views = total_views + 1 WHERE quesid='20440'1UPDATE questions SET total_views = total_views + 1 WHERE quesid='20440'

/opt/clerks-staging/docroot/include/functions/main.php 1765 update_Faqviewcount() ()

SELECT * FROM questions WHERE quesid!='20440' AND status='1' AND (question like '% difference id class?%' OR question like '%difference%' OR question like '%class?%') -- ORDER BY RAND() LIMIT 151SELECT quesid, question, seo, userid FROM questions WHERE quesid!='20440' AND status='1' AND (question like '% difference id class?%' OR question like '%difference%' OR question like '%class?%') -- ORDER BY RAND() LIMIT 15

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() ()

SELECT * FROM seoclerks.members WHERE USERID='17130' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='17130' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM seoclerks.members WHERE USERID='10788' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='10788' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM seoclerks.members WHERE USERID='1677' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='1677' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM seoclerks.members WHERE USERID='632' limit 11SELECT profilepicture FROM seoclerks.members WHERE USERID='632' limit 1

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_member_profilepicture()

SELECT * FROM members_ledger WHERE script='/opt/clerks-staging/docroot/viewfaq.php' AND querystring LIKE '%id=20440%' AND added>=UNIX_TIMESTAMP(NOW())-1200 GROUP BY USERID 1SELECT USERID, username FROM members_ledger WHERE script='/opt/clerks-staging/docroot/viewfaq.php' AND querystring LIKE '%id=20440%' AND added>=UNIX_TIMESTAMP(NOW())-1200 GROUP BY USERID

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() ()

SELECT * FROM categories1SELECT * FROM categories

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() parseRedundantQueriesCache()

select * from categories_software order by name asc1select * from categories_software order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_GetSoftwareCategories()

select * from categories_wanttobuy order by name asc1select * from categories_wanttobuy order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_wantcategories()

select * from categories_wanttotrade order by name asc1select * from categories_wanttotrade order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_get_tradecategories()

SELECT * FROM seoclerks.members WHERE USERID='23245.png'1SELECT profilepicture FROM seoclerks.members WHERE USERID='23245.png'

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() getUserProfileImage()

SELECT * FROM seoclerks.members WHERE USERID='589438.jpg'1SELECT profilepicture FROM seoclerks.members WHERE USERID='589438.jpg'

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() getUserProfileImage()

select * from categories_faq order by name asc1select * from categories_faq order by name asc

/opt/clerks-staging/docroot/libraries/adodb5/adodb.inc.php 1899 CacheExecute() insert_GetFaqCategories()

Invalid SQL

count(*)sql1error_msg

Expensive SQL

Tuning the following SQL could reduce the server load substantially
LoadCountSQLMaxMin

Suspicious SQL

The following SQL have high average execution times
Avg TimeCountSQLMaxMin
0.1146621SELECT A.wantid, A.title, A.p1, A.maxprice, B.name, B.seo FROM wanttobuy A, categories_wanttobuy B WHERE A.wantid != 73800 AND A.category=B.CATID AND A.active=1 AND (A.tags like '%wordpress website email shipping ecommerce woocomerce%' ) LIMIT 40.1146620.114662
0.1013261SELECT * FROM members WHERE show_freelancer = 1 AND status = 1 AND total_recommendations > 0 AND (skills LIKE '%socialmediabots%') ORDER BY total_recommendations desc LIMIT 0,400.1013260.101326
0.0627011SELECT count(USERID) AS total FROM members WHERE show_freelancer = 1 AND status = 1 AND total_recommendations > 0 AND (skills LIKE '%socialmediabots%') 0.0627010.062701