There are two types of html tags, inline elements and block-level elements. First, let's understand the concepts of inline elements and block-level elements: Block-level elements: Generally, they are containers for other elements. They can hold inline elements and other block-level elements. Block-level elements exclude other elements from being on the same line as them. They can set width and height attributes. Block-level elements in the normal flow will be placed vertically. Common block elements are "div" Inline elements (inline elements): Inline elements can only contain text or other inline elements. They are descendants of block-level elements. They allow other inline elements to be located on the same line with them. The height and width cannot be set. A common inline element is "a". According to the concept of block-level elements, we can understand that block-level elements have line breaks before and after them, which is equivalent to adding a <br> tag before and after the element. We can think of block-level elements as a block or a rectangle, so block-level elements can set height and width attributes example: Copy code The code is as follows:#div1{ width:200px; height:200px; background:#666 } div2{ width:200px; height:200px; background:#F00 } html file: Copy code The code is as follows:<div id="div1"> div1 Block-level elements exclude other elements from being placed on the same line as them </div> <div id="div2"> div2 Block-level elements exclude other elements from being placed on the same line as them </div> Display effect: ![]() The two div elements are not on the same line According to the concept of inline elements, we can understand that there are no line breaks before and after inline elements. We can think of an inline element as a line, so it cannot have height and width attributes set. Block element tags address - address Inline element a - anchor point |
<<: Solutions for high traffic websites
>>: CSS achieves the effect of hiding the scroll bar and scrolling the content (three ways)
The method found on the Internet works The footer ...
Compared with fdisk, parted is less used and is m...
1. Overflow Overflow is overflow (container). Whe...
grammar Here is the generic SQL syntax for INSERT...
Source: http://www.ruoyi.vip/ import Vue from ...
Create an HTML page with an unordered list of at l...
Related articles: Beginners learn some HTML tags ...
1 Background JDK1.8-u181 and Tomcat8.5.53 were in...
Table of contents 1. Basic Concepts of GTID 2. GT...
This article introduces the sample code of CSS pi...
mysql gets all dates or months in a time period 1...
Suppose a user management system where each perso...
Table of contents introduction Install Homebrew I...
question The seamless scrolling of pictures and t...
Table of contents 1. Props Parent >>> Ch...