Jump to content

How to style a label with for?


Recommended Posts

<label for=ʺedit-submitted-eventinformation-how-longʺ>How long <span class=ʺform-requiredʺ title=ʺThis field is required.ʺ>*</span></label>



I have the code which has no ID. For some reason, I can not give ID using the tool. Can I still css the label using the for? If yes, can you please help?





Link to comment
Share on other sites

You can select an element by its attribute using the square bracket selector as in this example:

label[for=edit-submitted-eventinformation-how-long] {  color: red;}

What "tool" are you using to write your HTML? Your environment should give you full control of the HTML you're writing.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...