Custom Selectors#
Selectors are one of the methods that we can style or animate the html. See how a great many websites are based on the following:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Title</title>
</head>
<body></body>
</html>
The part that is standardised sections are clearly demarcated, whilst in the customised part <body>, it's a bit of a free-for-all. Many websites use a mixture of <div> and <span> combined with class to distinguish which <div> or <span> is being selected in css or javascript. It is not too clear where one section starts and finishes or which parts are dependancies to which part. How often have you used a text editor to show the dependancy of the closing </div>. Compare to the webpage start <html>, <head> and <title> each has its own individual closure.
A slight improvement is to use radio buttons or unordered lists (bullet points) as a framework.
Matthew James Taylor makes a forceful case for custom tags. Essentially a custom tag acts like the inline tag <span> if required for page structure, like <div>, then the custom tag has to be set to display a block:
my-custom-tag {
display: block;
}
Registration#
Matthew James Taylor states that registration is not required, however definition is necessary, when checking on each of the custom tags had an error of undefined element. After listing the tags, the HTML was validated.
If the custom tags are being used for more complicated behaviour than just replacing <span> or <div> then registration is required. Mozilla has a utility X-Tag to help with the registration.