function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Harshith C ASCHarshith C ASC 

can we apply css props for id in SLDS??

Hi, I'm new to SF...while I'm practicing on playground i came across a doubt that when i try to apply CSS props for id it won't work...it only work for classes? I need to know about it.
<p id="demo"> Hello </p>
<p class="abc"> world </p>

i wanna apply Css props for Hello now.. How do i do it?
Best Answer chosen by Harshith C ASC
ANUTEJANUTEJ (Salesforce Developers) 
Sorry, Harshith as mentioned in documentation https://developer.salesforce.com/docs/component-library/documentation/en/lwc/create_components_css there is "No support for ID selectors in CSS. Make sure that id values are unique within your HTML template. When the template is rendered, id values may be transformed into globally unique values. If you use an ID selector in CSS, it won’t match the transformed ID." I hope this addresses your question.

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Harshith,

If I get the question right I think you are looking for a way to override slds with custom css, if that is correct can you check the below thread that has a similar scenario discussed.

>> https://salesforce.stackexchange.com/questions/242148/how-to-override-css-of-lightning-component

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
Harshith C ASCHarshith C ASC
Thanks Anutej, I'll definitely check
Harshith C ASCHarshith C ASC
User-added imageUser-added image

Anutej i couldn't get it sorry...let's say I want "Hello" text in bold... i can do it using class but by applying for id it's an error
I wanna know is it possible? if not why? 
Thank you
ANUTEJANUTEJ (Salesforce Developers) 
Sorry, Harshith as mentioned in documentation https://developer.salesforce.com/docs/component-library/documentation/en/lwc/create_components_css there is "No support for ID selectors in CSS. Make sure that id values are unique within your HTML template. When the template is rendered, id values may be transformed into globally unique values. If you use an ID selector in CSS, it won’t match the transformed ID." I hope this addresses your question.
This was selected as the best answer