HTML block

HTML <div> and <span>

HTML can combine elements through <div> and <span>.

HTML Block Element

Most HTML elements are defined as block-level elements or inline elements.

Block-level elements usually start (and end) with a new line when displayed by the browser.

Examples: <h1>, <p>, <ul>, <table>

HTML inline elements

Inline elements usually do not start on a new line when displayed.

Example: <b>, <td>, <a>, <img>

HTML <div> element

The HTML <div> element is a block-level element that can be used as a container to combine other HTML elements. The

<div> element has no specific meaning. In addition, since it is a block-level element, the browser will display line breaks before and after it.

If used with CSS, the <div> element can be used to set style attributes on large blocks of content. Another common use of the

<div> element is in document layout. It replaces the old-fashioned way of using tables to define layouts. Using the <table> element for document layout is not a correct use of tables. The <table> element is used to display tabular data.

HTML <span> with elements

HTML <span> elements are inline elements that can be used as containers for text

The

<span> element also has no specific meaning.

When used with CSS, the <span> element can be used to set style attributes for portions of text.

<!DOCTYPE html>   
<html> 
<head>
<meta charset="utf-8">
<style>
</style>
</head>  
<body>   
  <div>
     <p>标题</p>
  <span>
  内容
  </span>
  </div>
</body>   
</html>


Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> </style> </head> <body> <div> <p>标题</p> <span> 内容 </span> </div> </body> </html>
submitReset Code