Top
Best
New

Posted by todsacerdoti 15 hours ago

You can make up HTML tags(maurycyz.com)
397 points | 138 commentspage 5
zkmon 11 hours ago|
That is ... XML without schema but with CSS support. Cool.
Devasta 5 hours ago||
You've always been able to do it, doesn't even need to be HTML, serialise as XHTML and you can include the tags on your own namespace and have separate CSS for them.

<!DOCTYPE html>

<html

        xmlns="http://www.w3.org/1999/xhtml"

        xmlns:ns1="mynamespace"

        xmlns:ns2="yournamespace"
>

<body>

<CustomElement>Hello</CustomElement><!-- Custom element in the XHTML namespace -->

<ns1:CustomElement>Hello</ns1:CustomElement>

<ns2:CustomElement>Hello</ns2:CustomElement>

<style type="text/css">

    @namespace ns1 "mynamespace";

    @namespace ns2 "yournamespace";

    CustomElement {

        color:green;

    }

    ns1|CustomElement {

        color:red;

    }

    ns2|CustomElement {

        color:blue;

    }
</style>

</body>

</html>

superkuh 14 hours ago||
https://blog.jim-nielsen.com/2023/html-web-components/ - Jim Nielsen has a series of posts on how to use made up HTML tags in a way that doesn't just fail to nothing when the javascript defining the custom-element doesn't get successfully executed.
why-o-why 11 hours ago||
Isn't this the basis for every web framework? E.g., Vue Templates?
ayhanfuat 8 hours ago|
Frameworks generally change those to standart tags at build time. Vue can be used without a build step so it indeed uses custom tags for components in that scenario but it is not very common to use Vue without a build step.
orliesaurus 13 hours ago||
If this works, then the point of having standards, is just for screen readers??
system2 8 hours ago||
I will refuse this idea until it is widely known, accepted, and used by everyone. Div with class is easier to inspect and modify with pseudo. I wonder what would happen with JS getting the element with this, too.
nektro 13 hours ago||
the comments here informing us they default to behaving like <span> instead of like <div> is the biggest disappointment of my day so far
gitaarik 12 hours ago||
I think it makes sense that if HTML detects an unknown element that it doesn't give it block styling automatically. Only if you specifically specified it for that type of element.

Inline styling is kind of the default in HTML.

rasso 9 hours ago||
See my other comment: you can set default styles using

:where(:not(:defined)) { display: block }

singpolyma3 13 hours ago||
You can but you never ever should. Do not do this. Use the `class` attribute to provide extra context about the kind of data your tag represents, that is what it is for.
yawaramin 12 hours ago||
See https://news.ycombinator.com/item?id=46417607
lytedev 12 hours ago||
Why is this?
eviks 10 hours ago||
> Good luck trying to insert something inside of “article-heading” but after “article-quote” on the first try.

You don't need much, but an editor - collapse the sections to get the view as small as in the blog snippet, and then you'll have both opening and closing of the tag you're in highlighted, so you won't miss and won't need any luck

rascul 11 hours ago|
> Good luck trying to insert something inside of “article-heading” but after “article-quote” on the first try.

Indentation can help.

More comments...