HTML5 New Elements

http://www.w3schools.com/html/html5_new_elements.asp

New Elements in HTML5

The internet, and the use of the internet, has changed a lot since 1999, when HTML 4.01 became a standard.    
Today, several elements in HTML 4.01 are obsolete, never used, or not used the way they were intended. All those elements are removed or re-written in HTML5.   
To better handle today's internet needs, HTML5 has also included new elements for drawing graphics, displaying media content, for better page structure and better form handling, and several new APIs for drag and drop, for finding your geological location, for storing local data, and more.  
Below is a list of the new HTML elements, introduced by HTML5, and a description of what they are used for.  

The New <canvas> Element

Note:  The links in the tables below point to our  HTML5 Reference . However, you will learn more about these new elements in this tutorial.   

TagDescription
<canvas>Defines graphic drawing using JavaScript


New Media Elements


TagDescription
<audio>Defines sound or music content
<video>Defines video or movie content
<source>Defines sources for <video> and <audio>
<track>Defines tracks for <video> and <audio>
<embed>Defines containers for external applications (like plug-ins)

New Form Elements

TagDescription
<datalist>Defines pre-defined options for input controls
<keygen>Defines a key-pair generator field (for forms)
<output>Defines the result of a calculation

New Semantic/Structural Elements

HTML5 offers new elements for better structure:  
TagDescription
<header>Defines a header for the document or a section
<hgroup>Groups heading elements
<nav>efines navigation links in the document
<section>Defines a section in the document
<main>Defines the main content of a document
<article>Defines an article in the document
<aside>Defines content aside from the page content
<footer>Defines a footer for the document or a section
<details>Defines additional details that the user can view or hide
<summary>Defines a visible heading for a <details> element
<figure>Defines self-contained content, like illustrations, diagrams, photos, code listings, etc.
<figcaption>Defines a caption for a <figure> element
<mark>Defines marked or highlighted text
<time>Defines a date/time
<bdi>Defines a part of text that might be formatted in a different direction from other text outside it
<wbr>Defines a possible line-break
<dialog>Defines a dialog box or window
<command>Defines a command button that a user can invoke
<meter>Defines a scalar measurement within a known range (a gauge)
<progress>Defines the progress of a task
<ruby>Defines a ruby annotation (for East Asian typography)
<rt>Defines an explanation/pronunciation of characters (for East Asian typography)
<rp>Defines what to show in browsers that do not support ruby annotations

Removed Elements

The following HTML 4.01 elements has been removed from HTML5:  
  • <acronym>
  • <applet>
  • <basefont>
  • <big>
  • <center>
  • <dir>
  • <font>
  • <frame>
  • <frameset>
  • <noframes>
  • <strike>
  • <tt>




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用开源的iText库将Java HTML转换为PDF。以下是一个示例代码: ```java import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.PageSize; import com.itextpdf.text.html.simpleparser.HTMLWorker; import com.itextpdf.text.pdf.PdfWriter; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; public class HtmlToPdfConverter { public static void main(String[] args) throws Exception { String html = "<html><body><h1>Hello, world!</h1></body></html>"; String pdfPath = "/path/to/pdf/file.pdf"; convertHtmlToPdf(html, pdfPath); } public static void convertHtmlToPdf(String html, String pdfPath) throws IOException, DocumentException { // Create document and writer Document document = new Document(PageSize.LETTER); PdfWriter.getInstance(document, new FileOutputStream(new File(pdfPath))); // Open document document.open(); // Parse HTML into list of elements List<com.itextpdf.text.Element> elements = parseHtml(html); // Add elements to document for (com.itextpdf.text.Element element : elements) { document.add(element); } // Close document document.close(); } private static List<com.itextpdf.text.Element> parseHtml(String html) throws IOException { // Create input stream from HTML string InputStream is = new ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)); // Parse HTML into list of elements List<com.itextpdf.text.Element> elements = new ArrayList<>(); HTMLWorker htmlWorker = new HTMLWorker(elements); htmlWorker.parse(is); // Return list of elements return elements; } } ``` 在上面的示例代码中,我们使用iText库的`Document`和`PdfWriter`类来创建PDF文件。我们还使用了`HTMLWorker`类将HTML字符串解析为iText元素列表。最后,我们将iText元素添加到PDF文档中,并将文档保存到文件系统中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值