Classification of elements HTML tags

In HTML, HTML tag elements are roughly classified into three different types: inline elements (also known as the line element), a block element, inline block elements.

Common inline elements include:

<a>、<span>、<br />、<i>、<em>、 <strong>、<label>、<q>、<var>、<cite>、<code>

The characteristics of inline elements:

  1. And other inline elements are displayed on the same line
  2. Width, height, top and bottom margins of the element can not be set
  3. The width of the elements is that it contains text or image width can not be changed

CSS code by display: inline element is set to the inline elements:

    div {
        display: inline;
    }

Commonly used block elements are:

<div>、<p>、<h1>…<h6 />、<ul>、<ol>、 <table>、<address>、<blockquote>、<form>

Block element features:

  1. Each block element begins a new line, and the subsequent cut is also a separate line element (a block element on a separate line)
  2. Width, height, top and bottom margins can be set elements
  3. Width of the element is not provided in the case of 100% of his own parent container

CSS code by display: block element is set to the block elements:

    div {
        display: block;
    }

Common inline block elements are:

<img>、<input>

Inline block element features:

  1. Or other inline elements and inline block elements are displayed on the same line
  2. Width, height, top and bottom margins can be set elements

CSS code by display: inline-block element to the inline block elements:

    div {
        display: inline-block;
    }

Guess you like

Origin www.cnblogs.com/dyfblogs/p/11391691.html
Recommended