There's nothing to say. This is a common error. We can try to determine whether the logo should be an H1 tag, but this is not the focus of our discussion. The real problem lies in the misuse of the figure element. Figure should only be referenced in the document or surrounded by section elements. I think your logo is not very likely to be referenced in this way. Simple. Do not use figure. You only need to do this:
Figure is not just an image
Another common misunderstanding about figure is that it is only used by images. Figure can be a video, audio, a chart, a reference text, a table, a piece of code, a piece of prose, and any combination of them or others. Do not limit figure to images. Web standards precisely describe content using tags.
5. Do not use unnecessary type attributes
This is a common problem, but it is not a mistake. I think we should avoid this style through best practices.
In HTML5, the type attribute is no longer required for script and style elements. However, these are likely to be automatically added by your CMS, so removing them is not that easy. However, if you are manually coding or you have full control over your template, there is no reason to include the type attribute. All browsers think that scripts are javascript and styles are css. You don't have to do this any more.
<! -- Do not copy this code! It is too redundant! --> <Link type = "text/css" rel = "stylesheet" href = "css/styles.css"/> <script type = "text/javascript" src = "js/scripts "/> </script>
In fact, you only need to write as follows:
<link rel="stylesheet" href="css/styles.css" /><script src="js/scripts" /></script>
Even the code of the specified character set can be omitted. Mark Pilgrim explained in the semantic chapter of Dive into HTML5.
6. incorrect use of form attributes
HTML5 introduces some new form attributes. The following are precautions for use:
Boolean attribute
Some multimedia elements and other elements also have a Boolean attribute. The rules mentioned here also apply.
Some new form attributes are Boolean, which means that as long as they appear in the tag, the corresponding behavior has been set. These attributes include:
- Autofocus
- Autocomplete
- Required
Frankly speaking, I seldom see this. Taking required as an example, the following is common:
<! -- Do not copy this code! This is wrong! --> <Input type = "email" name = "email" required = "true"/> <! --
Another Error example --> <input type = "email" name = "email" required = "1"/>
Strictly speaking, this is not a serious problem. As long as the browser's HTML Parser sees that the required attribute appears in the tag, its function will be applied. But what if you write equired = "false" in turn?
<! -- Do not copy this code! This is wrong! --> <Input type = "email" name = "email" required = "false"/>
The parser will still regard the required attribute as valid and execute the corresponding behavior, even though you try to tell it not to execute it. This is obviously not what you want.
There are three effective ways to use the Boolean attribute. (The last two types are only valid in xthml)
- Required
- Required = ""
- Required = "required"
The correct example is as follows:
<Input type = "email" name = "email" required/>
[I have a QQ Group for front-end learning and communication: 328058344 if you encounter any problems during the process of learning the front-end, please come to my QQ Group to ask questions. The group will update some learning resources every day. Chat is prohibited .]