


[HTML Basics] Top-level elements, block elements, inline elements, variable elements, element attributes_html/css_WEB-ITnose
Jun 24, 2016 pm 12:34 PM
Top-level elements:
說明:頂級元素表現(xiàn)如塊,屬于高級塊元素。
例如:html,body,framesetBlock elements:
特點:獨占一行,寬(100%)、高、行高、padding、margin可控div 常用于布局p 段落h1~h6 標(biāo)題ol{li} 有序列表ul{li} 無序列表dl{dt,dd} 自定義列表table{tr,th,td,thead,tbody,tfoot,caption,col,colgroup} 表格form 表單pre 預(yù)文本格式address 地址blockquote 塊引用fieldset{legend} 控件組hr 水平線menu{li} 菜單列表noscriptlegend 定義fieldset標(biāo)題 HTML5新增:section 區(qū)塊article 文章塊aside 除主要內(nèi)容外的內(nèi)容塊header 頁眉footer 頁腳nav 導(dǎo)航hgroup{h1~h6} 標(biāo)題組合audio{source} 音頻video{source} 視頻canvas 圖形datalist{option} 下拉列表單details 元素細節(jié)figcaption 定義figure標(biāo)題figure{figcaption} 媒介內(nèi)容分組summary 定義details標(biāo)題已廢棄元素:center,dir,isindex,noframes,frame,framesetInline elements:
特點:不獨占一行,寬、高、行高、豎向padding、豎向margin不可改變a 鏈接img 圖片input 輸入框span 內(nèi)聯(lián)區(qū)域strong 粗體強調(diào)textarea 多行文本框select{optgroup,option} 下拉菜單label 表單標(biāo)注em 強調(diào)var 定義變量b 粗體i 斜體abbr 縮寫bdo 文本顯示方向br 換行cite 引用code 代碼dfn 項目kbd 鍵盤文本q 短引用samp 樣本代碼small 旁注,小字體文本sub 下標(biāo)sup 上標(biāo)HTML5新增:bdi 文本方向,脫離周圍文本方向command 命令按鈕keygen 密鑰mark 突出顯示文本meter 預(yù)定義范圍度量output 定義輸出類型progress 進度條ruby 定義ruby注釋rt 定義ruby注釋解釋rp 不支持ruby顯示的內(nèi)容time 日期/時間source 定義媒體元素的媒介資源 track 定義媒體元素的文本軌道已廢棄元素:acronym,big,font,s,strike,tt,u,xmpMutable elements:
說明:可變元素根據(jù)上下文確定該元素是塊元素還是內(nèi)聯(lián)元素。
button 按鈕del 刪除文本iframe 頁面嵌入ins 插入文本map{area} 圖像區(qū)塊object object對象script 客戶端腳本HTML5新增:embed 外部交互內(nèi)容或插件已廢棄元素:appletOther elements:
<!-- --> 定義注釋<!DOCTYPE> 文檔類型html 定義html文檔meta 元信息base 頁面默認(rèn)urlhead 文檔信息link 資源引用style 定義樣式已廢棄元素:basefontElement attributes:
id 元素唯一名class 元素類名title 提示信息style 內(nèi)聯(lián)樣式lang 語言編碼tabindex tab鍵控制次序{number}dir 內(nèi)容文本想法{ltr,rtl}accesskey 規(guī)定訪問元素的鍵盤快捷鍵{character}HTML5新增:contenteditable 是否允許編輯內(nèi)容{true,false}contextmenu 規(guī)定元素上下文菜單{id}data-value 自定義屬性draggable 是否允許拖動{true,false}hidden 規(guī)定該元素?zé)o關(guān){hidden}item 組合元素{empty,url}itemprop 組合項目{url,group,value}spellcheck 是否對元素進行拼寫或語法檢查{true,false}subject 規(guī)定元素對應(yīng)的項目{id}

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The key to keep up with HTML standards and best practices is to do it intentionally rather than follow it blindly. First, follow the summary or update logs of official sources such as WHATWG and W3C, understand new tags (such as) and attributes, and use them as references to solve difficult problems; second, subscribe to trusted web development newsletters and blogs, spend 10-15 minutes a week to browse updates, focus on actual use cases rather than just collecting articles; second, use developer tools and linters such as HTMLHint to optimize the code structure through instant feedback; finally, interact with the developer community, share experiences and learn other people's practical skills, so as to continuously improve HTML skills.

The reason for using tags is to improve the semantic structure and accessibility of web pages, make it easier for screen readers and search engines to understand page content, and allow users to quickly jump to core content. Here are the key points: 1. Each page should contain only one element; 2. It should not include content that is repeated across pages (such as sidebars or footers); 3. It can be used in conjunction with ARIA properties to enhance accessibility. Usually located after and before, it is used to wrap unique page content, such as articles, forms or product details, and should be avoided in, or in; to improve accessibility, aria-labeledby or aria-label can be used to clearly identify parts.

To create a basic HTML document, you first need to understand its basic structure and write code in a standard format. 1. Use the declaration document type at the beginning; 2. Use the tag to wrap the entire content; 3. Include and two main parts in it, which are used to store metadata such as titles, style sheet links, etc., and include user-visible content such as titles, paragraphs, pictures and links; 4. Save the file in .html format and open the viewing effect in the browser; 5. Then you can gradually add more elements to enrich the page content. Follow these steps to quickly build a basic web page.

To reduce the size of HTML files, you need to clean up redundant code, compress content, and optimize structure. 1. Delete unused tags, comments and extra blanks to reduce volume; 2. Move inline CSS and JavaScript to external files and merge multiple scripts or style blocks; 3. Simplify label syntax without affecting parsing, such as omitting optional closed tags or using short attributes; 4. After cleaning, enable server-side compression technologies such as Gzip or Brotli to further reduce the transmission volume. These steps can significantly improve page loading performance without sacrificing functionality.

To create an HTML checkbox, use the type attribute to set the element of the checkbox. 1. The basic structure includes id, name and label tags to ensure that clicking text can switch options; 2. Multiple related check boxes should use the same name but different values, and wrap them with fieldset to improve accessibility; 3. Hide native controls when customizing styles and use CSS to design alternative elements while maintaining the complete functions; 4. Ensure availability, pair labels, support keyboard navigation, and avoid relying on only visual prompts. The above steps can help developers correctly implement checkbox components that have both functional and aesthetics.

HTMLhasevolvedsignificantlysinceitscreationtomeetthegrowingdemandsofwebdevelopersandusers.Initiallyasimplemarkuplanguageforsharingdocuments,ithasundergonemajorupdates,includingHTML2.0,whichintroducedforms;HTML3.x,whichaddedvisualenhancementsandlayout

It is a semantic tag used in HTML5 to define the bottom of the page or content block, usually including copyright information, contact information or navigation links; it can be placed at the bottom of the page or nested in, etc. tags as the end of the block; when using it, you should pay attention to avoid repeated abuse and irrelevant content.

ThetabindexattributecontrolshowelementsreceivefocusviatheTabkey,withthreemainvalues:tabindex="0"addsanelementtothenaturaltaborder,tabindex="-1"allowsprogrammaticfocusonly,andtabindex="n"(positivenumber)setsacustomtabbing
