Why not use <ph> instead of <span> ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why not use <ph> instead of <span> ?

I never used <span> before. Isn't it for styling a specific text or element? This is amazing <span style="color:red"> isn't it </span> So if that is the usage, why not just use <ph> ?

12th Jun 2019, 10:08 PM
Ginfio
Ginfio - avatar
17 Answers
+ 1
If you remove ph from the CSS it won't look any different than normal text. So the browser obviously doesn't know what <ph> is supposed to do. And as you can see in the code I posted, you can use all kinds of non-existing tags and style them to your needs
13th Jun 2019, 5:30 AM
Anna
Anna - avatar
+ 8
Anna I agree. It's not clear if all browsers yet support "autonomous custom elements" - the technical name for such elements that do not extend from a builtin HTML element. https://caniuse.com/#feat=custom-elementsv1 For those who do want to use them, it's advised to use names with a hyphen to avoid possible name conflicts in the future with the release of new standard HTML elements. Here are some links for people to read up on if interested: https://www.webcomponents.org/specs#the-custom-elements-specification https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements https://html.spec.whatwg.org/multipage/custom-elements.html https://blog.revillweb.com/extending-native-dom-elements-with-web-components-233350c8e86a https://w3c.github.io/webcomponents/spec/custom/#autonomous-custom-element
13th Jun 2019, 6:27 AM
David Carroll
David Carroll - avatar
+ 3
Yes! there is a <ph> tag in HTML. I can't believe you guys haven't used it or seen it. WOW! it's my best friend and I use it all the time! Here I will show you... <ph> https://code.sololearn.com/WhChllf19pG0/?ref=app
13th Jun 2019, 4:48 AM
Ginfio
Ginfio - avatar
+ 3
ahh - now makes sense. back when I was learning HTML, i used <ph> thinking it stands for paragraph. and i had a question - what's the difference <ph> vs. <p>. Now bases on what you said I understand it. That's why i was able to use imoji as a class name - html is a dumy 😄
13th Jun 2019, 5:36 AM
Ginfio
Ginfio - avatar
+ 3
Looks like it, but I wouldn't rely on every browser being able to handle them. It's definitely not something you should do in real life, other than for educational/testing/fun purposes
13th Jun 2019, 5:42 AM
Anna
Anna - avatar
+ 2
never heard of it. there is a <p> tag though which is a block element. span on the other hand is an inline element, which is why it is used within the p tag.
13th Jun 2019, 12:17 AM
Logomonic Learning
Logomonic Learning - avatar
+ 2
Calviղ html6 !
13th Jun 2019, 12:43 AM
Logomonic Learning
Logomonic Learning - avatar
+ 2
wait--- there is html6??!
13th Jun 2019, 3:38 AM
Ginfio
Ginfio - avatar
+ 2
No there's no html6 yet and there's no <ph> tag also in html.
13th Jun 2019, 4:46 AM
‎وائل عبد الحق‎
‎وائل عبد الحق‎ - avatar
+ 2
take your time , i came here to learn
13th Jun 2019, 4:49 AM
‎وائل عبد الحق‎
‎وائل عبد الحق‎ - avatar
+ 1
what is ph?
13th Jun 2019, 12:13 AM
Logomonic Learning
Logomonic Learning - avatar
+ 1
paragraph - (i think)
13th Jun 2019, 12:14 AM
Ginfio
Ginfio - avatar
+ 1
ph tag? A new html5 tag? 😮
13th Jun 2019, 12:36 AM
Calviղ
Calviղ - avatar
+ 1
I don't know if you're kidding, but there's no ph tag just as there are no maurice or lampedusa tags https://code.sololearn.com/WsnToZH8uCBG/?ref=app
13th Jun 2019, 5:25 AM
Anna
Anna - avatar
+ 1
Anna , with that being said, could we use random tags (<ph> <rand> <abc> ) instead of <span> ?
13th Jun 2019, 5:40 AM
Ginfio
Ginfio - avatar
0
I just realized something. I think I confused you guys with the word 'tag'. I agree if you say it's not a tag. BUT... did you know it exists in HTML in whatever name it is | has (tag, attribute, input, or whatever it is). => https://code.sololearn.com/WhChllf19pG0/?ref=app
13th Jun 2019, 5:10 AM
Ginfio
Ginfio - avatar
0
Anna , I don't know where i got it from, and also i don't know that its a tag, but i know it works... right here: https://code.sololearn.com/WhChllf19pG0/?ref=app
13th Jun 2019, 5:28 AM
Ginfio
Ginfio - avatar