This is very vague, and you cannot expect a tutor on this sub dude. Make some effort at least. Geeksforgeeks, w3schools, ChatGPT, youtube. You have many resources. Be better
If you have a specific question about something you're trying to do, you can google "How to do <x> with CSS" and add "site:stackoverflow.com" after your google query to get only results for that which exist on Stack Overflow as a question.
<div></div> <!-- No identifier -->
<div id="container"></div> <!-- Unique identifier. Only this element can have this ID -->
<div class="item"></div> <!-- Group identifier. Any amount of elements can have the same class -->
Whenever you want to style any of these you need to tell css what to select.
div {
background-color: blue; /* This styles all divs in the page */
}
#cointainer {
background-color: red; /* This styles only the element with the specified id */
}
.item {
background-color: green; /* This styles all elements that have the item class */
}
Notice that css selectors have specificity. This means that if two selectors overlap a given property the most specific one will apply in the order `type -> class -> id`. So in the case of the example both the `div` selector and `#container` selector will affect the div with the id "container" but since the id selector has a higher specificity then the background will end up red.
2
u/YourAverageBrownDude Jan 02 '25
This is very vague, and you cannot expect a tutor on this sub dude. Make some effort at least. Geeksforgeeks, w3schools, ChatGPT, youtube. You have many resources. Be better
1
u/Haplo12345 Jan 02 '25
Read https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics to learn CSS. If you have specific, deep-dive technical inquiries, the actual, official CSS specifications are at https://www.w3.org/Style/CSS/specs.en.html but they're split up by topic and are very dry/not for beginner reading.
To test your skills, check out: https://flukeout.github.io/ and https://css-challenges.com/
If you have a specific question about something you're trying to do, you can google "How to do <x> with CSS" and add "site:stackoverflow.com" after your google query to get only results for that which exist on Stack Overflow as a question.
1
u/Maypher Jan 03 '25
html tags can have a number of identifiers
Whenever you want to style any of these you need to tell css what to select.
Notice that css selectors have specificity. This means that if two selectors overlap a given property the most specific one will apply in the order `type -> class -> id`. So in the case of the example both the `div` selector and `#container` selector will affect the div with the id "container" but since the id selector has a higher specificity then the background will end up red.