+ 9

Are all custom elements inline elements?

I made an element that evaluated it's content, and it seems that it is automatically an inline element. Would that be true? And if so, how would I make it a block-level element? https://code.sololearn.com/WozOcnic3uFe/?ref=app

29th Jul 2020, 10:55 AM
PresidentOfYes12
PresidentOfYes12 - avatar
8 Answers
+ 7
display: block;
29th Jul 2020, 11:00 AM
MSN
MSN - avatar
+ 20
Great question, 🌀PresidentOfYes12🌀, but not a good practice ☺. Let me elaborate on this more. Of course, they've always been interpreted as inline elements by various browsers, to prevent compatibility issues. You see back in the day browser vendors, like Microsoft and Netscape, invented their own tags compatible only with their browsers. Hence web page didn't look and feel the same in "rival" browsers. So it's obviously easier to render an element inline unless it is specifically declared otherwise. CSS will help you with that 😉. Now you can guess why it's not a very good idea ☺. In HTML5 the preferred is to use the supported tags and then customize them with CSS. Anyway I think experimenting is good for learning. Gekoda, I guess you meant "write" here. Happy coding 😄!
31st Jul 2020, 11:19 AM
🇺🇦 Drake CDR 🇺🇦
🇺🇦 Drake CDR 🇺🇦 - avatar
+ 10
Yes. By default all unknown elements are inline. Same applies to new HTML5 tags in old browsers. Use css to override the default styles customElement { display: block; }
29th Jul 2020, 12:12 PM
Dron Solarice
Dron Solarice - avatar
+ 10
You can right a rule in css: eval{ display:block; /*or:*/ display:inline-block; }
29th Jul 2020, 12:42 PM
Goke Ekundayo
Goke Ekundayo - avatar
+ 5
NUHEEN [INACTIVE] oh wow, thanks!
29th Jul 2020, 11:01 AM
PresidentOfYes12
PresidentOfYes12 - avatar
+ 5
It works, doesn't it?
29th Jul 2020, 11:02 AM
MSN
MSN - avatar
+ 5
NUHEEN [INACTIVE] I feel like when questions can be answered in one line, they aren't good, but yes, it works
29th Jul 2020, 11:03 AM
PresidentOfYes12
PresidentOfYes12 - avatar
+ 4
Vitya yeah😂😅
31st Jul 2020, 11:38 AM
Goke Ekundayo
Goke Ekundayo - avatar