+ 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
8 Réponses
+ 7
display: block;
+ 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 😄!
+ 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;
}
+ 10
You can right a rule in css:
eval{
display:block;
/*or:*/
display:inline-block;
}
+ 5
NUHEEN [INACTIVE] oh wow, thanks!
+ 5
It works, doesn't it?
+ 5
NUHEEN [INACTIVE] I feel like when questions can be answered in one line, they aren't good, but yes, it works
+ 4
Vitya yeah😂😅