+ 8
Can I use my own making tag inside html code?
I have just noticed that if I declare any of my own making selector like "ab" inside <style> tag and then use this tag inside <body> then it's working properly. My question is, is it ok to use these kind of code while making a dynamic website? I am giving you an example. <html> <head> <style> ab{ background-color:red; color:white; font-size:20px; } </style> </head> </body> <ab> This is a sentence </ab> </body> </html> If you play it, it will work properly.
6 odpowiedzi
+ 5
I am commenting so I could get notifications for someone with the answer. I was wondering the same thing just now!
+ 4
Kristofer Schultheis Actually you can subscribe to this thread without leaving an answer.
Notice the blue star at lower left of question? It is for "following" (and also unfollowing).
You can click on that without answering to follow a thread. 😉
Just for extra information, actually its usage is usually opposite:
Usually after we answer a question, we will unfollow that thread to avoid being flooded in notification by others' answers, which ain't what we want to read.
+ 3
Yes
it is called custom element
it will not cause error
but if you have not defined it in JavaScript,
it will be UnknownElement and has no behavior, just like a span
to define it, the code is like this :
https://code.sololearn.com/WpM7Lm6fFDgI/?ref=app
(the codes added by me starts from line 57, the above are from Calvin which I kept for reference)
For more details, mdn doc:
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements
+ 3
Martin Taylor Yes, it is a very advanced JavaScript skill to create your own element.
Learning custom element used to help in preparing to learn React component syntax.
However, since there is React Hooks now, it is less important to learn the component syntax.
By the way, I noticed your profile picture, and like to share this drawing by Domino with you:
https://code.sololearn.com/WzGIADYzj0EX/?ref=app
+ 2
Gordon thank you very much!