semantic-markup

How to properly use h1 in HTML5

和自甴很熟 提交于 2019-11-26 17:58:19
问题 Which of the following is the correct way to structure a page: 1) h1 only in header <header> <h1>Site title</h1> <nav>...</nav> </header> <section> <h2>Page title</h2> </section> If I use h1 exclusively inside header as the site's title, every page will have the same content for the h1 tag. That doesn't seem very informative. 2) h1 in header and section , for both site and page title <header> <h1>Site title</h1> <nav>...</nav> </header> <section> <h1>Page title</h1> </section> I've also seen

HTML5 nested sections and heading tags

こ雲淡風輕ζ 提交于 2019-11-26 16:44:00
I have section tags nested underneath another section tag. Is it okay to have start the headings from 1 again? For example: <section> <h1>Page Title</h1> <section> <h1>Section Title</h1> <h2>Section Sub Title</h2> <p>Sub section text</p> </section> <section> <h1>Section Title</h1> <h2>Section Sub Title</h2> <p>Sub section text</p> </section> </section> Thanks, Mark unor Yes, it’s valid. However, HTML5 encourages to use […] headings of the appropriate rank for the section's nesting level. But it’s not a requirement, so you are free to choose. Using h1 everywhere allows for moving sections

Is it correct to use DIV inside FORM?

ⅰ亾dé卋堺 提交于 2019-11-26 15:50:16
问题 I'm just wondering what are you thinking about DIV-tag inside FORM-tag? I need something like this: <form> <input type="text"/> <div> some </div> <div> another </div> <input type="text" /> </form> Is it general practice to use DIV inside FORM or I need something different? 回答1: It is totally fine . The form will submit only its input type controls ( *also Textarea , Select , etc...). You have nothing to worry about a div within a form . 回答2: It is completely acceptable to use a DIV inside a

Knowing what RDFA vocabulary to use

北战南征 提交于 2019-11-26 14:47:00
How do we know which vocabulary/namespace to use to describe data with RDFa? I have seen a lot of examples that use xmlns:dcterms="http://purl.org/dc/terms/" or xmlns:sioc="http://rdfs.org/sioc/ns#" then there is this video that uses FOAF vocabulary. This is all pretty confusing and I am not sure what these vocabularies mean or what is best to use for the data I am describing. Is there some trick I am missing? The simplest thing is to check if schema.org covers your needs. Schema.org is backed by Google and the other major search engines and generally pretty awesome. If it doesn't suit your

Are block-level elements allowed inside inline-level elements in HTML5?

半城伤御伤魂 提交于 2019-11-26 14:37:35
For an example Is <a href="#"><h1>Heading</h1></a> valid in HTML5? yes what you've written is valid in HTML5, but it's not all inline elements, I think it's just <a> 's it applies to.. Reference: “Block-level” links in HTML5 Tip: if using this set the <a> to display: block; or there may be unintended visual styling results : Source: Test Case Update: It is "disallowed" for other "block in inline" combinations where "default styles are likely to lead to confusion" - explanation is here : Cases where the default styles are likely to lead to confusion Certain elements have default styles or

Marking up a search result list with HTML5 semantics

谁说我不能喝 提交于 2019-11-26 14:12:35
问题 Making a search result list (like in Google) is not very hard, if you just need something that works. Now, however, I want to do it with perfection, using the benefits of HTML5 semantics. The goal is to define the defacto way of marking up a search result list that potentially could be used by any future search engine. For each hit, I want to order them by increasing number display a clickable title show a short summary display additional data like categories, publishing date and file size My

w3c html validation error - Section lacks heading. Consider using h2-h6 elements to add identifying headings to all sections

主宰稳场 提交于 2019-11-26 12:45:16
问题 I am getting a warning when I try to validate my page in http://validator.w3.org : Section lacks heading. Consider using h2-h6 elements to add identifying headings to all sections. My code is as below : <section id=\"slider-wrapper-new\"> <div class=\"slider-container-new\"> // some code.. </div> </section> How can I remove this error ? Do I compulsory need to add h1 - h6 tags inside section heading ? 回答1: Either: Add a heading ( h1 , ..., h6 ) tag to your section element. Replace your

Is a DIV inside a TD a bad idea?

白昼怎懂夜的黑 提交于 2019-11-26 11:45:56
It seems like I heard/read somewhere that a <div> inside of a <td> was a no-no. Not that it won't work, just something about them not being really compatible based on their display type. Can't find any evidence to back up my hunch, so I may be totally wrong. Using a div instide a td is not worse than any other way of using tables for layout. (Some people never use tables for layout though, and I happen to be one of them.) If you use a div in a td you will however get in a situation where it might be hard to predict how the elements will be sized. The default for a div is to determine its width

input type=“submit” Vs button tag are they interchangeable?

怎甘沉沦 提交于 2019-11-26 11:38:29
input type="submit" and button tag are they interchangeable? or if there is any difference then When to use input type="submit" and when button ? And if there is no difference then why we have 2 tags for same purpose? MatTheCat http://www.w3.org/TR/html4/interact/forms.html#h-17.5 Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content. For example, a BUTTON element that contains an image functions like and may resemble an INPUT element whose type is set to "image", but

Using custom HTML Tags

痞子三分冷 提交于 2019-11-26 10:35:43
In my html I was curious if it was semantically correct to use unique identifiers such as <toys> </toys> to hold an image rather than an <h2> . For example: Is it preferred to have: <toys class="grid_4 push_2">&nbsp</toys> with the css: toys { background: url("toys.png") no-repeat scroll 0 0 transparent; width: 181px; height: 93px; margin-top: -8px; } instead of: I currently have: <h1 class="grid_4 push_2">&nbsp</h1> with the css: h1 { background: url("toys.png") no-repeat scroll 0 0 transparent; width: 181px; height: 93px; margin-top: -8px; } Is the use of unique identifiers like <toys>