LeonLatex Posted March 29, 2022 Share Posted March 29, 2022 A while ago I got an answer to the difference between .class and .id. Got a good and understandable answer there. The following question goes on almost the same. After <style> why does someone put only a * in front of a { What does this mean? Then there are two other things. I usually enter, for example, a class for a div, for example like this: div.font but then I see there are others who do not put anything in front .font - what is the difference? Other times, some enter only a # .font Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted March 29, 2022 Solution Share Posted March 29, 2022 1 hour ago, LeonLatex said: After <style> why does someone put only a * in front of a { What does this mean? * means any element. 1 hour ago, LeonLatex said: I usually enter, for example, a class for a div, for example like this: div.font but then I see there are others who do not put anything in front .font - what is the difference? Other times, some enter only a # .font div.font only applies to DIVs with a "font" class while .font applies to any type of element with a "font" class. # is for IDs. These are fairly basic CSS questions... Quote Link to comment Share on other sites More sharing options...
LeonLatex Posted March 30, 2022 Author Share Posted March 30, 2022 (edited) On 3/29/2022 at 4:11 PM, requinix said: * means any element. I thought so, but i had to ask to be sure. div.font only applies to DIVs with a "font" class while .font applies to any type of element with a "font" class. I am aware of that. I dont think that was part of the questions 😊👍 (Sorry requinix. I read your answer one more time and understood i missed the meaning about .font . Actualy that was what i was asking about 😂😂🤓👍 # is for IDs. These are fairly basic CSS questions... Ok. That didn't tell me much other than # is for ID's, and you have told me before requinix that ID can only be used on one place or one time (or something like that). Right requinix? But what does the # do/tell to do in a ID? Appreciate you help and your teaching requinix. Thank you 😊 Edited March 30, 2022 by LeonLatex Quote Link to comment Share on other sites More sharing options...
kicken Posted March 30, 2022 Share Posted March 30, 2022 3 hours ago, LeonLatex said: But what does the # do/tell to do in a ID? The # just signifies an ID, like how . signifies a class. So #font would be whatever element has the attribute id="font", while .font would be any element with class="font". ID's must be unique within a document, classes can be reused any number of times. ID's also have a higher priority than classes in the case of conflicting rules. You should probably just read up on CSS Selectors and get familiar with them. 1 Quote Link to comment Share on other sites More sharing options...
LeonLatex Posted March 31, 2022 Author Share Posted March 31, 2022 13 hours ago, kicken said: The # just signifies an ID, like how . signifies a class. So #font would be whatever element has the attribute id="font", while .font would be any element with class="font". ID's must be unique within a document, classes can be reused any number of times. ID's also have a higher priority than classes in the case of conflicting rules. You should probably just read up on CSS Selectors and get familiar with them. You saved me a lot of time, so i don't have to use time on reading me up on 5 pages describing the answer it takes only 4 lines to describe. Thanks, kicken 👍😊 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.