html5 header element tag html5New tag element
1. header Basic introduction to tag elements - TOP
Before the HTML5 version, it was customary to use div tags to layout web pages. In HTML5, a new header tag element is added based on the DIV tag. Also called "
It should be recognized by everyone that "header" is a commonly used name in html layout, so a new header tag element is added in HTML5. You can understand why the header is added as a label element in html5.
In addition to using the header tag directly, you can also set class or id to the header.
2. Syntax structure - TOP
The header tag element is used the same as div. There is a beginning and a closing.
Grammar:
1. Don’t give id or class directly
2. Set id
3. Set class
4. Features: Like the DIV tag element, it can be used multiple times, and id or class can be used to set different styles in different places.
3. Compatibility - TOP
Because the header tag is a new tag element in HTML5, it is not supported by older versions of browsers. It requires IE9+ or above browsers, the latest Google Chrome and other browsers. support. Of course, domestic browsers such as 360 Browser, Baidu Browser, and Aoyou Browser all use the IE kernel that comes with the system, so domestic browsers are actually the same version as the IE version that comes with your system, so you IE BrowserIn IE9 or above, it is naturally compatible with the new tag elements of HTML5.
4. Comparison case of old and new DIV layout - TOP
Observe and master the application of header by comparing DIV+CSS layout and HTML5+CSS layout.
1. DIVCSS5 instance HTML5+CSS complete code
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>html5 Header标签实例 DIVCSS5</title> <style> /* 传统布局CSS */ #header{ width:300px; height:40px; background:#CCC} /* HTML5布局样式 */ header{ width:400px; height:70px; color:#F00; background:#F5F5F5} .color-000{ color:#000; background:#666} </style> </head> <body> <div id="header"> 我在传统div布局中 </div> <header> 我在传统div布局中,必须在支持HTML5浏览器才能看到效果, 建议谷歌浏览器测试观察效果 </header> <header class="color-000"> 我颜色为黑色,背景为#666 </header> </body> </html>
2. Effect screenshot
div and header layout effect screenshot
DIVCSS5 Special tip: The code is screenshotted in DW software, and the effects are rendered in PS on Google Chrome (supports HTML5) browser. Ordinary IE6-IE8 do not support HTML5 and cannot see the HTML5 layout effect. You need IE9 and above browsers to see the layout effect.
The above is the detailed content of html5 tag layout tutorial. For more information, please follow other related articles on the PHP Chinese website!

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.


Hot AI Tools

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

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

Undress AI Tool
Undress images for free

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

WebStorm Mac version
Useful JavaScript development tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
