Keygen html5 usage
Keygen html5 usage
You can use custom tags in browsers, although they won’t be HTML5 (see Are custom elements valid HTML5? and the HTML5 spec.
Let's assume you want to use a custom tag element called stack . Here's what you should do.
Normalize its attributes in your CSS Stylesheet (think css reset) - Example.
Make it work in old versions of Internet Explorer by appending this script to the head (Important.
Then you can use your custom tag freely.
Feel free to set attributes as well.
Absolutely correct. Not a fantastic idea. But absolutely correct. You could make a whole army of your own tags on your page, and make them all backwards-compatible with IE6, just by adding an array of all of the tag names you want to use, and then creating each one inside a for-loop, in your page head, before you start using any of them. That s how the html5shim works in the first place. Just be prepared to put effort into styling them in old-IE. Also, while I d say this is okay for internal-use, it s not really how I d want to teach people to do things. At all. Norguard Jul 16 '12 at 19:32.
I agree, writing your own tags is not for the faint of heart. Make sure you test it thoroughly. I would like to say one thing though. don t write CSS for IE6. Completely waste of resources and enables further use of such a horrible product that not even Microsoft endorses. Timothy Perez Jul 17 '12 at 1:00.
Very important note: Although browsers support creating a custom element, it s not officially supported by the HTML5 standard. Technically . custom elements are verboten. You can do it, and make your HTML look all nice and semantically important, but you are breaking the standard if you do -- if you care. ) Randolpho Aug 16 '12 at 19:25.
I'm not so sure about these answers. As I've just read: "CUSTOM TAGS HAVE ALWAYS BEEN ALLOWED IN HTML.
The point here being, that HTML was based on SGML. Unlike XML with its doctypes and schemas, HTML does not become invalid if a browser doesn't know a tag or two. Think of marquee . This has not been in the official standard. So while using it made your HTML page "officially unapproved", it didn't break the page either.
Then there is keygen , which was Netscape-specific, forgotten in HTML4 and rediscovered and now specified in HTML5. And also we have custom tag attributes now, like data-XyZzz=". " allowed on all HTML5 tags.
So, while you shouldn't invent a whole custom unspecified markup salad of your own, it's not exactly forbidden to have custom tags in HTML. That is however, unless you want to send it with an +xml Content-Type or embed other XML namespaces, like SVG or MathML. This applies only to SGML-confined HTML.
answered May 11 '10 at 1:05.
Also of interest here: You can use any tag name in HTML, and it will be part of the DOM and can be styled. mario May 11 '10 at 1:21.
“So while using it made your html page official unapproved , it didn t break the page either.” — um, try styling your invented elements in Internet Explorer. It won’t work. You might not consider that broken, but the fact that custom tags are invalid and don’t work in Internet Explorer, I don’t see how you can argue they’re “allowed”. Paul D. Waite Jun 3 '10 at 11:55.
Creating your own tag names in HTML is not possible / not valid. That's what XML, SGML and other general markup languages are for.
What you probably want is.
Or instead of div/ and span/ something like ul/ and li.
As Michael suggested in the comments, what you want to do is quite possible, but your nomenclature is wrong. You aren't "adding tags to HTML 5," you are creating a new XML document type with your own tags.
I did this for some projects at my last job. Some practical advice.
When you say you want to "add these to HTML 5," I assume what you really mean is that you want the pages to display correctly in a modern browser, without having to do a lot of work on the server side. This can be accomplished by inserting a "stylesheet processing instruction" at the top of the xml file, like ?xml-stylesheet type="text/xsl" . Replace with the path to the XSL stylesheet that you create to convert your custom tags into HTML.
Caveats: Your file must be a well-formed XML document, complete with XML header xml version="1.0" . XML is pickier than HTML about things like mismatched tags. Also, unlike HTML, tags are case-sensitive. You must also make sure that the web server is sending the files with the appropriate mime type "application/xml". Often the web server will be configured to do this automatically if the file extension is but check.
Big Caveat: Finally, using the browsers' automatic XSL transformation, as I've described, is really best only for debugging and for limited applications where you have a lot of control. I used it successfully in setting up a simple intranet at my last employer, that was accessed only by a few dozen people at most. Not all browsers support XSL, and those that do don't have completely compatible implementations. So if your pages are to be released into the "wild," it's best to transform them all into HTML on the server side, which can be done with a command line tool, or with a button in many XML editors.
answered May 10 '10 at 14:45.
I just want to add to the previous answers that there is a meaning to use only two-words tags for custom elements. They should never be standardised.
For exemple, you want to use the tag icon . because you don't like img . and you don't like i neither.
Well, keep in mind that you're not the only one. Maybe in the future, w3c and/or browsers will specify/implement this tag.
At this time, browsers will probably implements native style for this tag and your website's design may broke.
So I'm suggesting to use (according to this exemple) img-icon.
As a matter of fact, the tag menu is defined; not so used, but defined. It should contain menuitem which behave like li.
answered Nov 18 '15 at 0:37.
For embedding metadata, you could try using HTML microdata. but it's even more verbose than using class names.
answered May 10 '10 at 14:52.
Besides writing an XSL stylesheet, as I described earlier, there is another approach, at least if you are certain that Firefox or another full-fledged XML browser will be used (i.e. NOT Internet Explorer). Skip the XSL transform, and write a complete CSS stylesheet that tells the browser how to format the XML directly. The upside here is that you wouldn't have to learn XSL, which many people find to be a difficult and counterintuitive language. The downside is that your CSS will have to specify the styling very completely, including what are block nodes, what are inlines, etc. Usually, when writing CSS, you can assume that the browser "knows" that em , for instance, is an inline node, but it won't have any idea what to do with dish.
Finally, its been a few years since I tried this, but my recollection is that IE (at least a few versions back) refused to apply CSS stylesheets directly to XML documents.
answered May 10 '10 at 14:56.
Yeah, I think IE goes into a special XML rendering mode, and pretty much shows you a prettified, collapsible version of the XML document. Paul D. Waite Jun 3 '10 at 11:56.
This is not an option in any HTML specification.
You can probably do what you want with div elements and classes, from the question I'm not sure exactly what you're after, but no, creating your own tags is not an option.
answered May 10 '10 at 12:51.
As Nick said, custom tags are not supported by any version of HTML.
But, it won't give any error if you use such markup in your HTML.
It seems like you want to create a list. You can use unordered list ul to create the rool elements, and use the li tag for the items underneath.
If that's not what you want to achieve, please specify exactly what you want. We can come up with an answer then.
answered May 10 '10 at 12:55.
It won t give you an error in the browser, but IE handles CSS on unknown tags oddly. ceejayoz May 10 '10 at 13:14.
Hmmm, now I didn t know that! I knew that the unknown CSS names are handled oddly (that s an error). But, are you sure it handles the unknown tags oddly too? Doesn t it just render them without the text in the tags? Kirtan May 10 '10 at 13:35.
The point of HTML is that the tags included in the language have an agreed meaning, that everyone in the world can use and base decisions on - like default styling, or making links clickable, or submitting a form when you click on an input type="submit.
Made-up tags like yours are great for humans (because we can learn English and thus know, or at least guess, what your tags mean), but not so good for machines.
answered May 10 '10 at 16:53.
Polymer or X-tags allow you to build your own html tags. It is based on native browser's "shadow DOM.
answered Jul 18 '13 at 14:29.
You can just do some custom css styling, this will create a tag that will make the background color red.
answered Mar 23 '15 at 6:56.
answered Mar 14 '16 at 17:42.
Brilliant. Any idea why this has not been upvoted or accepted? rnso May 7 at 1:26.
I found this article on creating custom HTML tags and instantiating them. It simplifies the process and breaks it down into terms anyone can understand and utilize immediately -- but I'm not entirely sure the code samples it contains are valid in all browsers, so caveat emptor and test thoroughly. Nevertheless, it's a great introduction to the subject to get started.
In some circumstances, it may look like creating your own tag names just works fine. However, this is just your browser's error handling routines at work. And the problem is, different browsers have different error handling routines.
See this example. The first line contains two made-up elements, what and ever. and they get treated differently by different browsers. The text comes out red in IE11 and Edge, but black in other browsers. For comparison, the second line is similar, except it contains only valid HTML elements, and it will therefore look the same in all browsers.
Another problem with made-up elements is that you won't know what the future holds. If you created a website a couple of years ago with tag names like picture. dialog. details. slot. template etc, expecting them to behave like spans, are you in trouble now.
answered Jun 6 at 9:35.
2017 Stack Exchange, Inc.