Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add new elements to HTML

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article, the editor introduces in detail "how to add new elements for HTML", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to add new elements to HTML" can help you solve your doubts.

Modern browsers support HTML5.

In addition, all browsers, both old and up-to-date, automatically treat unrecognized elements as inline elements.

Because of this, you can "teach" browsers to deal with "unknown" HTML elements.

Note you can even teach IE6 (WindowsXP2001) browsers to handle unknown HTML elements.

Define a HTML5 element as a block element

HTML5 defines eight new HTML semantic (semantic) elements. All these elements are block-level elements.

To enable older browsers to display these elements correctly, you can set the value of the display property of CSS to block:

Example

Header,section,footer,aside,nav,main,article,figure {

Display:block

}

Add a new element to HTML

You can add new elements to HTML.

This instance adds a new element to HTML and defines a style for the element, which is named:

Example

Add a new element to HTML

Document.createElement ("myHero")

MyHero {

Display:block

Background-color:#ddd

Padding:50px

Font-size:30px

}

My first title

My first paragraph.

My first new element

The JavaScript statement document.createElement ("myHero") adds a new element to the IE browser.

Read here, this article "how to add new elements to HTML" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report