1

I want to know if I am able to define a custom HTML attribute that can take 2 or more values just as the 'CLASS" attribute. For instance, considering I define a "Data-Text" and in css I write:

[data-text=light]{color:white;}
[data-text=bold]{font-weight:bolder;}

Now, can I make a trick that if I write :

<p data-text = "light bold"> something </p>

both commands (font-weight and color) happen for the <p> tag?

1
  • try this visit link Commented Feb 24, 2021 at 22:20

1 Answer 1

1

it is possible when you use the css "~="

[data-text~=light]{color:white;} [data-text~=bold]{font-weight:bolder;}

this should work just fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.