semantic-markup

Markup for postal addresses

北城余情 提交于 2019-11-26 09:45:04
问题 Which HTML5 markup should we use for postal addresses? And which vocabulary could we use for enabling machine-readability? As an example, the address of W3C’s main office: W3C/MIT 32 Vassar Street Room 32-G515 Cambridge, MA 02139 USA 回答1: The address element must only be used if this postal address represents the contact information for "its nearest article or body element ancestor", which, of course, is not the case for all addresses. But if address is used or not, it doesn’t affect the

Valid to use <a> (anchor tag) without href attribute?

我的梦境 提交于 2019-11-26 06:59:13
问题 I\'ve been using Twitter Bootstrap to build a site, and a lot of its functionality depends on wrapping things in <a> , even if they\'re just going to execute Javascript. I\'ve had problems with the href=\"#\" tactic that Bootstrap\'s documentation recommends, so I was trying to find a different solution. But then I tried just removing the href attribute altogether. I\'ve been using <a class=\'bunch of classes\' data-whatever=\'data\'> , and having Javascript handle the rest. And it works. Yet

Should a heading be inside or outside a <p>?

末鹿安然 提交于 2019-11-26 06:46:57
问题 I have a div element and within that div, we have text between p elements. I want to add a heading. Should it go inside or outside the p? Which is better: <p>This is text <h3>This is my h3</h3> More text </p> <p>another text<p> or <p>This is text<p> <h3>This is my h3</h3> <p>another text<p> 回答1: It is impossible to put a heading element inside a p element in HTML markup, not just formally but because browsers implicitly terminate an open p element when they encounter a heading. So the

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

余生长醉 提交于 2019-11-26 05:50:43
问题 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? 回答1: 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

HTML5 nested sections and heading tags

独自空忆成欢 提交于 2019-11-26 04:55:49
问题 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 回答1: Yes, it’s valid. However, HTML5 encourages to use […] headings of the appropriate rank for the section's nesting level. But

Knowing what RDFA vocabulary to use

房东的猫 提交于 2019-11-26 04:00:50
问题 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? 回答1: The simplest thing is to check if schema.org covers your needs. Schema.org

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

梦想的初衷 提交于 2019-11-26 03:58:36
问题 For an example Is <a href=\"#\"><h1>Heading</h1></a> valid in HTML5? 回答1: 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:

Using custom HTML Tags

99封情书 提交于 2019-11-26 03:28:39
问题 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

<code> vs <pre> vs <samp> for inline and block code snippets

落爺英雄遲暮 提交于 2019-11-26 02:39:11
My site is going to have some inline code ("when using the foo() function...") and some block snippets. These tend to be XML, and have very long lines which I prefer the browser to wrap (i.e., I don't want to use <pre> ). I'd also like to put CSS formatting on the block snippets. It seems that I can't use <code> for both, because if I put CSS block attributes on it (with display: block; ), it will break the inline snippets. I'm curious what people do. Use <code> for blocks, and <samp> for inline? Use <code><blockquote> or something similar? I'd like to keep the actual HTML as simple as

Is a DIV inside a TD a bad idea?

我的未来我决定 提交于 2019-11-26 02:34:34
问题 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. 回答1: 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