顯示具有 HTML5 標籤的文章。 顯示所有文章
顯示具有 HTML5 標籤的文章。 顯示所有文章

2012年12月26日 星期三

Html5 常用 Tag

HTML5 New Tags

HTML5 新增了許多 Tag,這些Tag 部份著重在語意上。因此,什麼場景使用什麼Tag顯的相當重要。但UI看起來並沒有差異,故大部份的開發人員其實不太重視。
以下是我的翻譯,翻的不好請見諒。

header

header : The header element represents a group of introductory or navigational aids. 一群由簡介文或輔助瀏覽的元素。

section

section : The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading. 章節元素表達一個文件或應用程式的一個一般的章節。一個章節,通常有個標題,對其內的內容做簡單的專題。

section 的目的,通常用來製作成大綱(outline)。因此不要用 section 來作為套用樣式的手段。如果目的只是套用樣式,就使用 div  即可。

hgroup

hgroup: the heading of a section. The element is used to group a set of h1h6 elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines. section 通常有個標題。若標題由 h1 ~ h6 組成,則 hgroup 將這些 h1~h6 內挑出一個最高等級做為此 section 的大綱。

如下例,hgroup 內含了h1, h2,則該section 會以h1的文字作為 outline

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
    <body>
        <h1>The Body</h1>
        <section>
            <hgroup>
                <h1>H1</h1>
                <h2>H2</h2>
            </hgroup>
        </section>
    </body>
</html>

image

nav

The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links。一個由一組連結組成的章節。

article

The article element represents a self-contained composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content. article 是一個獨立的組合,因此將 article 獨立出來或移到別的地方,都不會讓該 article 失去意義。

一個簡單的方式辨別 article 是否為適當的 tag,就是檢視該內容是否適合作為 RSS 的文章。

aside

The aside element represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography. 支援性的文章。不看 aside 的內容並不影響對整個內容的了解。通常用於註解或廣告。

footer

The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. 包含章節結束的資訊。例如作者資訊,相關文章連結, copyright data。

2012年12月22日 星期六

實用的 HTML5 Outliner

Html5

開發 Html5 網頁時,常常沉淪在 UI 的視覺效果、功能的實作、資料庫的存取效能等看的出來的「需求」,卻忘了 Html5 的一個 Outline (大綱)特色。

大綱功能的出現,可以幫助瀏覽器快速的掌握該網頁的主要架構,有助於 SEO(搜尋引擎最佳化),甚至讓瀏覽器快速地呈現出網頁。因此,了解自己的網頁大綱是否正常,是一個必須面對的課題。

要了解大綱,就去看一看 Html5 的 spec 吧。

工具

有沒有實用的小功具可以幫助我們來檢查網頁的大綱呢?Google Chrome 上有個 extension:

https://chrome.google.com/extensions/detail/afoibpobokebhgfnknfndkgemglggomo

以 yahoo 新聞首頁來 check 一下吧。好像不錯啊!

image

檢查我自己在開發的網站一下。

SNAGHTML418bc80

哦!不妙!快點修改吧!Untitled …代表有大綱章節(section)卻沒有章節名稱(section name),就好像一本書的目錄( table of content)出現一堆的(未命名)一樣醜。誰也不看這樣的書吧。

參考

  1. HTML5的文檔大綱 : 寫的很詳細。懶惰的我,是寫不出這樣的好文章的。
  2. HTML5 語意標籤(SEMANTICS)與大綱(OUTLINE

2011年6月23日 星期四

安裝 HTML5 Support for Visual Studio 2010

HTML5 Support for Visual Studio 2010

微軟的 Visual Studio 2010 終於支援 HTML5 的編輯了。看了Announcing the Web Standards Update - HTML5 Support for the Visual Studio 2010 Editor,就下載了 Visual Studio Web Standards Update

問題

怪事發生了,一旦執行 Web Standards Update.msi,就會出現 Service pack 1 for visual studio 2010 must be installed 的警告訊息。我的確有安裝 SP1 for VS2010 啊!

SNAGHTML2ac48c

解決

如果有安裝 Windows SDK 的話,可從修改 msi 檔著手。以我的機器為例,在 C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\ 下有個 Orca.msi,安裝後,執行 Orca。

image

打開 Web Standard Update.msi 後, 在左方 Tables 內選 CustomAction, 在 VSDCA_VsdLaunchConditions 上按右鍵 ,執行 Drop Row功能。

SNAGHTML3205d8

記得按儲存鍵。

image

執行

由於我們修改了 msi,數位簽章就失效了,執行時會出現如下圖的警告訊息,這是正常的。按「Run」以繼續執行。

SNAGHTML34ad88

然後,就可以安裝了。

SNAGHTML35d9c4

SNAGHTML364f42

執行 Visual Studio 2010.建立一個新的 Web Application後,可以選擇 HTML5 來檢查格式。

image

當我們打入 <vi時,會出現 video 的 intellisense (智能提示)。果然好用。

image

參考

我將修改好的 msi 放在這裡,有需要的人可以自行下載。

Share with Facebook