How to use id with pseudo selecor?

I have a CSS file where I have a body tag. I have given that tag an id of “bdy”. Can I write a pseudo selector for all paragraph tags inside the body with that class? I was doing it like this.

#bdy p:first-child {
	margin-top: 35px
}

However, I do see the rule affecting the page. Thanks for any help.

Did you mean you don’t see the rule affecting the page?

Yes sorry. Thanks

1 Like

It’s difficult to know what’s going on without seeing the HTML to which the CSS is being applied.

Thanks so much for the reply TechnoBear and Gandalf. I realized that the JavaScript is generating the css and overriding what I have in the CSS file. Got it on this . In the future I will include the code. Thanks

2 Likes