semantic-markup

Semantic markup for language switcher

不羁岁月 提交于 2019-12-17 17:03:36
问题 Which markup would you use for a language switcher element? Should it be placed before <header> and .skiplink ? Should it be prepended with heading? Any live examples? Here is what I'm using now: <header> <div><a href="#content" class="skiplink">Skip to content</a></div> <h1> <a href="/">Site Name - the best site</a> </h1> </header> <ul class="langSwitch"> <li class="langPl"><img src="/gfx/pl.png" alt="Polski" /></li> <li class="langEn"><a rel="nofollow" href="/en" hreflang="en" lang="en" xml

Why does the HTML5 header element require a h tag?

不羁岁月 提交于 2019-12-17 16:45:27
问题 According to HTML5Doctor.com and other HTML5 introductory sites, the header element should contain a h1-h6 tag plus other navigational or introductory content. However, the traditional 'header' on most websites consists of just a logo and some navigational elements. A lot of major sites including Facebook and Twitter use a h1 tag for their logo, which seems illogical to me, since the logo is not the most important or most informative element on the page. A h1 tag appears in the content

Proper definition for “tabular data” in HTML

北慕城南 提交于 2019-12-17 16:33:51
问题 I have a pedantic argument that needs resolution. As a proper koolaid drinker when it comes to HTML, I'm all about semantic markup. As a result, of course I hate to see tables where they don't belong. The rule of thumb for tables is that you should only use them for "tabular data", but it has come to my attention that this is a really poorly defined phrase. I wanted to make the following data a table, but others at my office disagreed that a table would be semantically correct in this case

Proper definition for “tabular data” in HTML

天涯浪子 提交于 2019-12-17 16:33:02
问题 I have a pedantic argument that needs resolution. As a proper koolaid drinker when it comes to HTML, I'm all about semantic markup. As a result, of course I hate to see tables where they don't belong. The rule of thumb for tables is that you should only use them for "tabular data", but it has come to my attention that this is a really poorly defined phrase. I wanted to make the following data a table, but others at my office disagreed that a table would be semantically correct in this case

How to semantically tag poem text?

落花浮王杯 提交于 2019-12-17 15:49:20
问题 What to use for poem? pre blockquote code something else? 回答1: Don't use code (unless computer code is part of the poem). Don't use blockquote (unless you quote a poem). white space / line breaks: pre or br You may use the pre element. The spec gives an (informative) example: The following shows a contemporary poem that uses the pre element to preserve its unusual formatting, which forms an intrinsic part of the poem itself. <pre> maxling it is with a heart heavy that i admit loss of a feline

CSS/HTML: What is the correct way to make text italic?

那年仲夏 提交于 2019-12-17 10:14:49
问题 What is the correct way to make text italic? I have seen the following four approaches: <i>Italic Text</i> <em>Italic Text</em> <span class="italic">Italic Text</span> <span class="footnote">Italic Text</span> <i> This is the "old way". <i> has no semantic meaning and only conveys the presentational effect of making the text italic. As far as I can see, this is clearly wrong because this is non-semantic. <em> This uses semantic mark up for purely presentational purposes. It just happens that

When to use <br> line breaks vs CSS positioning?

天大地大妈咪最大 提交于 2019-12-17 09:40:04
问题 I've often wondered about the proper use of a <br> line break. Seems that often they are incorrectly used for positioning or clearing content where CSS should instead be used. W3schoools.org says to use <br> for blank lines, but not for creating or separating paragraphs. Looking over W3C HTML5 spec draft, it's a little clearer that the <br> would be used when content requires a line break such as lines of an address or blank lines in poetry, where intended by the author. But I'm still

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

风格不统一 提交于 2019-12-16 23:01:28
问题 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

Mapping words to numbers with respect to definition

江枫思渺然 提交于 2019-12-14 03:48:49
问题 As part of a larger project, I need to read in text and represent each word as a number. For example, if the program reads in " Every good boy deserves fruit ", then I would get a table that converts ' every ' to ' 1742 ', ' good ' to ' 977513 ', etc. Now, obviously I can just use a hashing algorithm to get these numbers. However, it would be more useful if words with similar meanings had numerical values close to each other, so that ' good ' becomes ' 6827 ' and ' great ' becomes ' 6835 ',

Please explain rowspan and colspan, col and colgroup

瘦欲@ 提交于 2019-12-13 11:39:22
问题 Can anyone explain rowspan and colspan , col and colgroup ? And are these W3C valid and semantically correct? Under which circumstances are these useful? 回答1: colspan <table border="1"> <tr> <th colspan="2">people are...</th> </tr> <tr> <td>monkeys</td> <td>donkeys</td> </tr> </table> rowspan <table border="1"> <tr> <th rowspan="2">monkeys are...</th> <td>... real monkeys</td> </tr> <tr> <td>... 'unreal' monkeys (people...)</td> </tr> </table> w3c as you see, this is for connecting table